reduce.reduce

No-seed version. The first element of r is used as the seed's value.

For each function f in fun, the corresponding seed type S is Unqual!(typeof(f(e, e))), where e is an element of r: ElementType!R for ranges, and ForeachType!R otherwise.

Once S has been determined, then S s = e; and s = f(s, e); must both be legal.

If r is empty, an Exception is thrown.

  1. auto reduce(R r)
    template reduce(fun...)
    reduce
    (
    R
    )
    (
    R r
    )
    if (
    isIterable!R
    )
    if (
    fun.length >= 1
    )
  2. auto reduce(S seed, R r)

Parameters

r
Type: R

an iterable value as defined by isIterable

Return Value

Type: auto

the final result of the accumulator applied to the iterable

Meta