Ruby-style "each" in D?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Mar 21 08:15:17 PDT 2014


On 3/21/14, 4:02 AM, monarch_dodra wrote:
> So I toyed around a little. I played with mostly tee/tap and each. The
> first observation is that both can help make a "2D" ufcs chain, which is
> pretty nice. It makes more sense (IMO) to code it that way, than to use
> awkward "join", to concatenate the "2D" range into a continuous "1D"
> range, eg: join(lines, "\n");
>
> First: "tee".

Nice work! This convinced me that tee should call the lambda only upon 
the first call to .front on each iteration.

Andrei




More information about the Digitalmars-d mailing list