next up previous contents index
Next: Functional programming Up: Built in functions Previous: Contexts   Contents   Index

Currying

If we have a program with the following function definition:
  foo(X Y) := X+Y

We can partially apply foo(X Y), and receive a curried lambda function:

  foo(1) := lambda([Y] 1+Y)

This can then be applied; eg in map or apply

  apply(foo(1) 2)     => 3  
  apply(foo 2 3)      => 5
  map(foo(5) [1 2 3]) => [6 7 8]



chris mungall 2006-02-09