Skip to main content

13.2 Lambda Expressions

A lambda expression is a function object written in Lisp. Here is an example:

(lambda (x)
"Return the hyperbolic cosine of X."
(* 0.5 (+ (exp x) (exp (- x)))))

In Emacs Lisp, such a list is a valid expression which evaluates to a function object.

A lambda expression, by itself, has no name; it is an anonymous function. Although lambda expressions can be used this way (see Anonymous Functions), they are more commonly associated with symbols to make named functions (see Function Names). Before going into these details, the following subsections describe the components of a lambda expression and what they do.

• Lambda Components  The parts of a lambda expression.
• Simple Lambda  A simple example.
• Argument List  Details and special features of argument lists.
• Function Documentation  How to put documentation in a function.