Thursday, 1 October 2009

currying

2> Adder = fun(X,Y) -> X+Y end.
#Fun<erl_eval.12.113037538>

3> AddTwo = fun(X) -> Adder(2,X) end.
#Fun<erl_eval.6.13229925>

4> Adder(3,4).
7

5> AddTwo(5).
7

Yariv's Blog: metacurrying (just for interest's sake)

No comments: