The OpenD Programming Language

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.

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

Parameters

r R

an iterable value as defined by isIterable

Return Value

Type: auto

the final result of the accumulator applied to the iterable

Throws

Exception if r is empty

Meta