wiki:MapFilterReduce

map filter reduce

map(F, [H|T])  ->  [F(H)|map(F, T)];
map(F, []) when is_function(F, 1)  ->  [].
filter(Pred, List) when is_function(Pred, 1) ->
    [ E || E <- List, Pred(E) ].

reduce is foldl

foldl(F, A, [H|T])  ->  foldl(F, F(H, A), T);
foldl(F, A, []) when is_function(F, 2)  ->  A.
Last modified 6 years ago Last modified on Oct 31, 2014, 7:55:07 PM
Note: See TracWiki for help on using the wiki.