Next: , Previous: interest, Up: GCL Reference


7.2.68 lambda

(lambda (ARG1 ...) EXPR1 ... EXPRN)
A lambda expression is like a function. To “call” a lambda expression, it has to be evoked like a function: ((lambda (arg) (+ 1 arg)) 2). In this example, the value of the entire expression would be 3. In general, the value of the call will be the value of EXPRN. The first list serves to define formal parameters. The lambda expression itself is just a list, starting with the key-word lambda, followed by several quoted lists. See (defun ...). See (setq ...). See (let ...). Note the argument list may contain the special keywords
&optional
giving values to the following identifiers is optional, their default value will be nil
&rest
all excess arguments will be collected in a list, and that list will be assigned to the following argument, like so:
               ((lambda (&rest rest) (echo rest)) a b c d)

The output would be (a b c d).