def

func:reduce

reduce(val, init, fn)

Reduce a collection to a single value with the given reducer function. The given function is called with each item in the collection along with a current accumulation value. The accumation value is initialized to init for the first item, and for every subsequent item it is the result of the previous item. Return the final accumulation value. Also see fold() which is preferred if doing standard rollup such as sum or average.

If working with a list, the function takes (acc, val, index) and returns accumulation value

If working with a grid, the function takes (acc, row, index) and returns accumulation value

If working with a stream, then function takes (acc, val) and returns accumulation value See Streams.

Examples:

[2, 5, 3].reduce(0, (acc, val)=>acc+val)  >> 10
[2, 5, 3].reduce(1, (acc, val)=>acc*val)  >> 30

meta

supertypes

feature

Feature namespace of definitions formatted as feature:name

    func

Axon function