having problem with `std.algorithm.each`

visitor via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 30 04:32:49 PST 2015


On Monday, 30 November 2015 at 12:03:08 UTC, anonymous wrote:
> On 30.11.2015 11:50, visitor wrote:
>> though i don"t understand why it fails silently ??
>
> ref2491's original code is valid, but doesn't have the intended 
> meaning. `e => {foo(e);}` is the same as `(e) {return () 
> {foo(e);};}`, i.e. a (unary) function that returns a (nullary) 
> delegate. Calling it does not run foo. In contrast, calling 
> this runs foo: `e => foo(e)`.

> `e => {foo(e);}` is the same as `(e) {return () {foo(e);};}`

Ok, Thanks ! :-)


More information about the Digitalmars-d-learn mailing list