Navigation
Synopsis Apply a function to successive elements of a set and combine the results (deprecated).
Function &T reducer(set[&T] st, &T (&T,&T) fn, &T unit)
Usage import Set;
Description Apply the function fn to successive elements of set s starting with unit.
Examples
rascal>import Set;
ok
rascal>int add(int x, int y) { return x + y; }
int (int, int): int add(int, int);
rascal>reducer({10, 20, 30, 40}, add, 0); 
int: 100
Pitfalls This function is deprecated, use a Reducer instead.
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.