is there a difference between those two notations

Christian Köstlin christian.koestlin at gmail.com
Mon Apr 30 12:11:37 PDT 2012


On 04/30/2012 07:04 PM, Jonathan M Davis wrote:
> On Monday, April 30, 2012 17:19:00 Christian Köstlin wrote:
>> reduce!((int a, int b){return a+b;})(iota(100))
>> reduce!("a+b")(iota(100))
>>
>> thanks in advance
>
> The first one directly creates a lambda, whereas the second one uses a string
> mixin with std.function.binaryFunc to create a lambda. The lambda generated
> for the second one will be the same as the one given in the first. They're just
> different ways to do the same thing.
>
> - Jonathan M Davis
thanks a lot ... should have had a look in 
https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm.d 
...

regards

christian koestlin


More information about the Digitalmars-d-learn mailing list