Peter Alexander wrote:
== Quote from Walter Bright ([email protected])'s articleThis can be defined instead as: alias reduce!"a+b" sum;But then you have to write: sum(sequence, 0) which is very unintuitive.
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]));
}
