September 22, 1999 | Perl and the Lambda Calculus | Slide #16 |
How to express a function of two arguments?
Example: Addition
Solution: (add 3) will return the function that adds 3 to its argument
Then ((add 3) 4) will return 7
We write (add 3 4) anyway
In general, (add n) will return the function that adds n to its argument
In general general, f(x, y, z, ...) can be turned into f(x)
f(x) returns a function which expects to get y ...
... and returns a function which expects to get z ...
... and ...
... which returns a function which expects to get the final argument ...
... and returns the result.
Next | Copyright © 1999 M-J. Dominus |