The 'flet' special form is basically a local block construct that allows local 'function' definitions followed by a block of code to evaluate. The first form after the 'flet' is the 'binding' form. It contains a series of 'functions'. The 'flet' form will go through and define the 'symbols' of the 'functions' and then sequentially execute the 'exprs'. The value of the last 'expr' evaluated is returned. When the 'flet' is finished execution, the 'symbols' that were defined will no longer exist.
(flet ((fuzz (x) (+ x x))) ; an FLET with FUZZ local function (fuzz 2)) ; returns 4 ; FUZZ no longer exists (fuzz 2) ; error: unbound function - FUZZ ; an empty flet (flet () (print 'a)) ; prints A
Note: 'flet' does not allow recursive definitions of functions. The label special form does allow this.
See the
flet
special form in the