The following code does not compile (with gdc) but if the line
containing taskPool.reduce is reduce it does compile. Any
pointers will be appreciated.
import std.stdio;
import std.math;
import std.algorithm;
import std.parallelism; // does not work!!
import core.thread;
double aCalculation(double result, int element) {
double r = 4.0*(pow(-1.0, element)/(2.0*cast(double)element +
1.0));
result += r;
return result;
}
void main() {
writefln("Result: %7.2f.", taskPool.reduce!aCalculation(0.0,
[0, 1, 2, 3, 4]));
}
-ish