I tried to create a working example from the std.parallelism taskPool.map code, and it throws with empty strings with length 1 being passed to to!double. Anyone have a working example? I'm building on Windows with 2.067.1 dmd.

import std.parallelism;
import std.algorithm;
import std.stdio;
import std.conv;
import std.math;
import std.range;
import std.file;

void main()
{

        auto fn = "numberList.txt";
        auto f = File(fn,"w");
        scope(exit) std.file.remove(fn);

        foreach (i ; iota(10.0,2_000.0)){
                f.writefln("%g",i+0.5);
        }

        f.close();

        auto lineRange = File(fn).byLine();
        auto dupedLines = std.algorithm.map!"a.idup"(lineRange);
        auto nums = taskPool.map!(to!double)(dupedLines);
        auto logs = taskPool.map!log10(nums);

        double sum = 0;
        foreach(elem; logs)
        {
                sum += elem;
        }
        writeln("sum=",sum);

}



Reply via email to