Often in D I want to do something like:
uint n; foreach(uint i; parallel(1..n)){ somefunc(i); }
That is, I want to make n function calls (somefunc) in parallel, using integers from 1 to n as arguments.
However, dmd does not seem to like 1..n here, so I end up doing goofy things like:
uint n; int[] nums = new int[n]; foreach(ulong index, int value; parallel(nums)){ sumfunc(index); }
Is there an idiomatic way to write this in D? Something not related to creating unnecessary extra variables?
source share