![]() |
|
Navigation |
Synopsis Apply a function to successive elements of list and combine the results (deprecated).
Function
&T reducer(list[&T] lst, &T (&T, &T) fn, &T unit)
Usage
import List;
Description Apply the function
fn to successive elements of list lst starting with unit .
Examples
rascal>import List; 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.
![]() |