Catamorphism
Any associative infix operator, either built-in or user-defined, may be turned into a reduce operator by putting it into square brackets (known as "the reduce metaoperator") and using it as a list operator. The operations will work left-to-right or right-to-left automatically depending on the natural associativity of the base operator.
Output:
In addition to the reduce metaoperator, a general higher-order function, reduce
, can apply any appropriate function. Reproducing the above in this form, using the function names of those operators, we have:
Last updated