Common Lisp the Language, 2nd Edition
A
function is anything that may be correctly given to the funcall
or apply function, and is
to be executed as code when arguments are supplied.
A compiled-function is a compiled code object.
A lambda-expression (a list whose car is the symbol lambda) may serve as a function. Depending on the implementation, it may be possible for other lists to serve as functions. For example, an implementation might choose to represent a ``lexical closure'' as a list whose car contains some special marker.
A symbol may serve as a function; an attempt to invoke a symbol as a function causes the contents of the symbol's function cell to be used. See symbol-function and defun.
The result of evaluating a function special form
will always be a function.
X3J13 voted in June 1988 (FUNCTION-TYPE)
to revise these specifications. The type function is to be disjoint
from cons and symbol, and so a list whose car is lambda
is not, properly speaking, of type function, nor is any symbol.
However,
standard Common Lisp functions that accept functional arguments
will accept a symbol or a list whose car is lambda
and automatically coerce it to be a function; such standard
functions include funcall, apply, and mapcar.
Such functions do not, however, accept a lambda-expression as a functional
argument; therefore one may not write
(mapcar '(lambda (x y) (sqrt (* x y))) p q)
but instead one must write something like
(mapcar #'(lambda (x y) (sqrt (* x y))) p q)
This change makes it impermissible to represent a lexical closure as a list whose car is some special marker.
The value of a function special form
will always be of type function.