Better lambdas!!!!!!!!!!

Meta via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 10 13:10:47 PDT 2015


On Thursday, 10 September 2015 at 19:37:53 UTC, Ola Fosheim 
Grøstad wrote:
> How about just having numbered parameters like this:
>
> { $2 < ($1*$2) }

What about this situation?

[[1, 2], [3, 4], [5, 6]].reduce!{
     auto localMax = { $1 > $2 ? $1 : $2; }
     auto first = $1.reduce!localMax;
     auto second = $2.reduce!localMax;

     return first > second ? first : second;
}

How can the compiler tell which $1 and $2 is which? What if one 
wants to access both the outer $1 and the inner $1 in localMax?


More information about the Digitalmars-d mailing list