Performs a reduction operation on the elements of this seq. This is equivalent to:
A result = identity;
foreach (G g in seq) {
result = accumulator(g, result);
}
return result;
but is not constrained to execute sequentially.
The identity value must be an identity for the combiner function. it means that: a is equal to combiner(identity, a)
The combiner function must be compatible with the accumulator function. it means that: accumulator(g, a) is equal to combiner(accumulator(identity, g), a)
This is a terminal operation.
accumulator |
an associative, non-interfering, and stateless function for accumulating |
combiner |
an associative, non-interfering, and stateless function for combining two values |
identity |
the identity value for the combiner function |
a future of the result of the reduction |