is there a difference between those two notations

bearophile bearophileHUGS at lycos.com
Mon Apr 30 14:03:35 PDT 2012


Christian Köstlin:

> reduce!((int a, int b){return a+b;})(iota(100))
> reduce!("a+b")(iota(100))

Today the syntaxes I prefer are:

iota(100).reduce!q{a + b}()

iota(100).reduce!((a, b) => a + b)()

But hopefully in some we'll have an efficient sum() function too 
in Phobos:

iota(100).sum()

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list