Adaptive Framework 0.9.0

reduce

The following is a list of properties for the function reduce:

PropertyValue
briefReduce values of a list to a single value
categoryhigher_order_list
descriptionReduce calls functor for each value in list with two parameters, accumulator and value, and must return a value of any dataType. Parameter accumulator is the reduce() accumulator parameter value on first call and the return value of previous functor() call on subsequent calls. The dataType of the return value should normally be the same as accumulator, but this is not required.
functionIdreduce
functionLabelreduce
puretrue
parameters[ { "dataType": "function", "dataTypeParameter": "(accumulator: any, value: any): any", "description": "This function is called for each value in a list. The returned value is passed as the accumulator parameter on the next call to functor().", "name": "functor" }, { "description": "This is an initial accumulator value passed to functor(). Normally, the dataType of accumulator will be the dataTape for the reduce() return value, but this is not required.", "name": "accumulator" }, { "dataType": "list", "description": "This is a list to be reduced.", "name": "list" } ]
returns{ "description": "This is the final return value from functor() or the accumulator parameter value if list is empty." }