taskPool.reduce()

Learn the use of the taskPool.reduce() function.

We'll cover the following...

Use of taskPool.reduce()

As with map(), it is helpful to explain reduce() from the std.algorithm module first.

reduce() is the equivalent of std.algorithm.fold, which you have seen before. The main difference between the two is that their function parameters are reversed. (Therefore, we recommend that you favor fold() for non-parallel code as it can take advantage of UFCS in chained range expressions.)

reduce() is another high-level algorithm commonly found in many functional languages. Just like map(), it takes one or more functions as template parameters. As its ...