On Tuesday, 4 April 2023 at 14:20:20 UTC, Steven Schveighoffer wrote:
parallel is a shortcut to `TaskPool.parallel`, which is indeed a foreach-only construct, it does not return a range.

I think what you want is `TaskPool.map`:

```d
// untested, just looking at the
taskPool.map!(/* your map function here */)
   (s.iota(len)).writeln;
```


I tried, thanks but it goes into infinite loop. For example, the first 50 of the sequence should have been printed to the screen immediately without waiting.

```d
long[50] arr;
RowlandSequence_v2 range;

auto next(long a)
{
  range.popFront();
  return arr[a] = range.front();
}

void main()
{
    range = RowlandSequence_v2(7, 2);
    taskPool.map!next(iota(50))/*
    s.iota(50)
     .map!next
     .parallel//*/
     .writeln;
}
```

On Tuesday, 4 April 2023 at 13:18:01 UTC, Ali Çehreli wrote:
I don't have time to experiment more at this time but I have the following chapters, which includes some of those other algorithms as well:

  http://ddili.org/ders/d/kosut_islemler.html

I read it, thanks...

SDB@79

Reply via email to