I like D
Dylan Knutson via Digitalmars-d
digitalmars-d at puremagic.com
Tue Mar 24 13:38:58 PDT 2015
> immutable nfields = header.count('\t');
> ...
> output.writeln(cycle("\t-").take(2 * nfields));
>
> Super-win, now I only ever have to update the original column
> list.
>
> Little things like this are what make me love D.
>
> -Steve
I see that `take` returns a lazy range. That's really neat! How
does writeln handle the lazy range though? Standard way of
dealing with ranges in D, with calls to empty, front, and
popFront (as in, does this code allocate any temporaries at all
with the GC?)
More information about the Digitalmars-d
mailing list