Peter Alexander wrote:
== Quote from Walter Bright (newshou...@digitalmars.com)'s article
This works:
import std.stdio;
import std.algorithm;
alias reduce!"a+b" sum;
auto sumOfSquares( R )( R range ) {
      return sum( map!"a*a"( range ) );
}
void main()
{
     writeln(sumOfSquares([1,2,3]));
}

But then this doesn't:

Darn!


int[] xs = [];
writeln(sum(xs));

but mathematically the sum is well-defined as 0 (and the product as 1).

Reply via email to