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 argumentThen

`((add 3) 4)`will return 7We write

`(add 3 4)`anywayIn general,

`(add n)`will return the function that adds*n*to its argumentIn 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 |