These forms make
let-like bindings to functions instead
This form establishes
let-style bindings for functions rather than values. Each binding must be a list of the form ‘(name arglist body...)’. Within forms, any reference to the function name uses the local definition instead of the global one.
A “reference” to a function name is either a call to that function, or a use of its name quoted by
functionto be passed on to, say,
The bindings are lexical in scope. This means that all references to the named functions must appear physically within forms.
Functions defined by
cl-fletmay use the full Common Lisp argument notation supported by
cl-defun; also, the function body is enclosed in an implicit block as if by
cl-defun. See Program Structure.
Note that the cl.el version of this macro behaves slightly differently. In particular, its binding is dynamic rather than lexical. See Obsolete Macros.
cl-labelsform is like
cl-flet, except that the function bindings can be recursive. The scoping is lexical, but you can only capture functions in closures if
t. See Closures, and Using Lexical Binding.
Lexical scoping means that all references to the named functions must appear physically within the body of the
cl-labelsform. References may appear both in the body forms of
cl-labelsitself, and in the bodies of the functions themselves. Thus,
cl-labelscan define local recursive functions, or mutually-recursive sets of functions.
Note that the cl.el version of this macro behaves slightly differently. See Obsolete Macros.