Template std.algorithm.iteration.reduce
Implements the homonym function (also known as accumulate, compress, inject, or foldl) present in various programming
languages of functional flavor. There is also fold which does
the same thing but with the opposite parameter order.
The call reduce!(fun)(seed, range) first assigns seed to
an internal variable result, also called the accumulator.
Then, for each element x in range, result = fun(result, x)
gets evaluated. Finally, result is returned.
The one-argument version reduce!(fun)(range)
works similarly, but it uses the first element of the range as the
seed (the range must be non-empty).
						
				template reduce(fun...)
				;
						
					
				Contained Functions
| Name | Description | 
|---|---|
| reduce | No-seed version. The first element of ris used as the seed's value. | 
| reduce | Seed version. The seed should be a single value if funis a
    single function. Iffunis multiple functions, thenseedshould be aTuple, with one field per function inf. | 
Returns
the accumulated result
Parameters
| Name | Description | 
|---|---|
| fun | one or more functions | 
See Also
    fold is functionally equivalent to reduce with the argument
    order reversed, and without the need to use tuple
    for multiple seeds. This makes it easier to use in UFCS chains.
    sum is similar to reduce!((a, b) => a + b) that offers
    pairwise summing of floating point numbers.
Example
Many aggregate range operations turn out to be solved with reduce
quickly and easily. The example below illustrates reduce's
remarkable power and flexibility.
import stdExample
Sometimes it is very useful to compute multiple aggregates in one pass.
One advantage is that the computation is faster because the looping overhead
is shared. That's why reduce accepts multiple functions.
If two or more functions are passed, reduce returns a
Tuple object with one member per passed-in function.
The number of seeds must be correspondingly increased.
import std