Contents
Next:
Funcall
Up:
FunctionsLambda Expressions,
Previous:
Eval
Lambda Expressions
The Lambda Expression is the heart of Lisp's notion of a function.
The term comes from Alonzo Church's ``lambda calculus'' -- a
development of mathematical logic. You can think of a lambda
expression as an anonymous function. Just like a function it has a
list of parameters and a block of code specifying operations on those
parameters.
For example:
> (setf product '(lambda (x y) (* x y)))
(LAMBDA (X Y) (* X Y))
> product
(LAMBDA (X Y) (* X Y))
Lambda expressions can be used in conjunction with apply to mimic function calls:
> (apply product '(3 4))
12
© Colin Allen & Maneesh Dhagat
November 1999