On Monday, 6 June 2016 at 11:25:00 UTC, Rene Zwanenburg wrote:
Could you elaborate a bit?
Yes.
I have an InputRange and need to pass it throughout a couple of
iteration and manipulation functions such as filter, map and
finishing by grouping with fold. Like:
----
myrange
.filter!xxx
.map!yyy
.tee!zzz
.fold!www
----
This process take a lot of time, so I decide to put it in
parallel. I did something like this:
----
Appender!www output;
foreach(iii; parallel(myrange))
{
only(iii)
.filter!xxx
.map!yyy
.tee!zzz
.copy(output)
}
output.fold!www;
----
only() will create a Range with one item in it. Also, I can't
group directly. I
need to use a second Range.
It works but it's not elegant as the non-working example above is.