Libraries anvil lang reduce

object reduce(object reducer, object elements)
object reduce(object reducer, object elements, object initialvalue)
Iterates through the given elements and calls reducer function so that the first parameter will be either the result of previous reducer call or intialValue (if it was given), and all other parameters, up to function's required parameter count are taken from the elements.
Parameters reducer -  Callable reducer taking from count parameters
intialValue -  initial value of reduction
Returns the return value of last call to reducer or initialValue