lambda
code: subr.el
(defmacro lambda (&rest cdr)
"Return an anonymous function.
Under dynamic binding, a call of the form (lambda ARGS DOCSTRING
INTERACTIVE BODY) is self-quoting; the result of evaluating the
lambda expression is the expression itself. Under lexical
binding, the result is a closure. Regardless, the result is a
function, i.e., it may be stored as the function value of a
symbol, passed to funcall' or mapcar', etc.
ARGS should take the same form as an argument list for a `defun'.
DOCSTRING is an optional documentation string.
If present, it should describe how to call the function.
But documentation strings are usually not useful in nameless functions.
INTERACTIVE should be a call to the function `interactive', which see.
It may also be omitted.
BODY should be a list of Lisp expressions.
(declare (doc-string 2) (indent defun)
(debug (&define lambda-list lambda-doc
def-body)))
;; Note that this definition should not use backquotes; subr.el should not
;; depend on backquote.el.
(list 'function (cons 'lambda cdr)))
code: example.el
((lambda () 1))
;; => 1
(funcall (lambda () 1))
;; => 1
(apply (lambda () 1) nil)
;; => 1