The OpenD Programming Language

reduce.reduce

Seed version. The seed should be a single value if fun is a single function. If fun is multiple functions, then seed should be a std.typecons.Tuple, with one field per function in f.

For convenience, if the seed is const, or has qualified fields, then reduce will operate on an unqualified copy. If this happens then the returned type will not perfectly match S.

Use fold instead of reduce to use the seed version in a UFCS chain.

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

Parameters

seed S

the initial value of the accumulator

r R

an iterable value as defined by isIterable

Return Value

Type: auto

the final result of the accumulator applied to the iterable

Meta