std.parallelism taskPool.map example throws exception
Jay Norwood via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Aug 7 17:41:42 PDT 2015
and, finally, this works using the taskPool.map, as in the
std.parallelism example. So, the trick appears to be that the
call to chomp is needed.
auto lineRange = File(fn).byLineCopy();
auto chomped = std.algorithm.map!"a.chomp"(lineRange);
auto nums = taskPool.map!(to!double)(chomped);
auto logs = taskPool.map!log10(nums);
double sum = 0;
foreach(elem; logs)
{
sum += elem;
}
writeln("sum=",sum);
More information about the Digitalmars-d-learn
mailing list