On Sun, 2011-03-06 at 10:08 -0500, bearophile wrote:
> Russel Winder:
> 
> >         reduce ! ( ( a , b ) { return a + b ; } ) ( 0.0 , outputData ) 
> > 
> > works just fine, but:
> > 
> >         reduce ! ( function double ( double a , double b ) { return a + b ; 
> > } ) ( 0.0 , outputData )
> 
> 
> import std.stdio, std.algorithm, std.range;
> 
> void main() {
>     auto outputData = iota(1.0, 10.0);
> 
>     auto r1 = reduce!((a, b){ return a + b; })(0.0, outputData);
>     writeln(r1);
> 
>     auto r2 = reduce!((double a, double b){ return a + b; })(0.0, outputData);
>     writeln(r2);
> 
>     auto r3 = reduce!("a + b")(0.0, outputData);
>     writeln(r3);
> 
>     auto r4 = reduce!q{a + b}(0.0, outputData);
>     writeln(r4);
> 
>     auto r5 = reduce!q{a + b}(outputData); // not exactly the same
>     writeln(r5);
> }
> 
> Bye,
> bearophile

So why does:

        reduce ! ( function double ( double a , double b ) { return a + b ; } ) 
( 0.0 , outputData )

fail?  It implies that a function literal and a lambda are significantly
different things as far as the compiler is concerned.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[email protected]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [email protected]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to