Ruby-style "each" in D?

monarch_dodra monarchdodra at gmail.com
Wed Mar 19 14:36:53 PDT 2014


On Wednesday, 19 March 2014 at 16:46:41 UTC, Dicebot wrote:
> My point is that `range.each!predicate` is much better replaced 
> with `range.tap!predicate.consume`. It keeps general rule of 
> range stuff being lazy and only single exception to bail out of 
> it has very readable clear name.
>
> One can argue that "consume" is same as proposed "each" with 
> no-op predicate but I think it is very important for 
> readability to keep exceptional behavior (eager consumption) 
> separated from utility behavior (tapping with a predicate).

This. I fully agree.


More information about the Digitalmars-d mailing list