Ruby-style "each" in D?
Jacob Carlborg
doob at me.com
Fri Mar 21 05:55:08 PDT 2014
On Friday, 21 March 2014 at 11:03:01 UTC, monarch_dodra wrote:
> each "tee" triggers on the call to `popFront`. It does its job
> (calls pred(r.front)), and then push the "pop down the chain.
> What this means is that my "tee's" are actually executed right
> to left! Talk about counter intuitive.
What's the purpose of "tee", is it the same as "tap"? "tap" in
Ruby just returns the receiver after executing a block. This
would be the implementation in D:
T tap (alias block, T) (T t)
{
block(t);
return t;
}
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list