You can use function EXT:EXPAND-FORM
to expand all the macros,
SYMBOL-MACRO
s, etc, in a single form:
(EXT:EXPAND-FORM
'(macrolet ((bar (x) `(print ,x))) (macrolet ((baz (x) `(bar ,x))) (symbol-macrolet ((z 3)) (baz z))))) ⇒(locally (print 3))
; the expansion ⇒; indicator: some expansion has actually been done
T
This is sometimes called a “code walker”,
except that a code walker would probably leave the MACROLET
and
SYMBOL-MACROLET
forms intact and just do the expansion.
Function EXT:EXPAND-FORM
is the exported part of the
CLISP interpreter (AKA EVAL
), so it expands forms by assuming the
EVAL-WHEN
situation :EXECUTE
and is therefore
unsuitable for forms that may later be passed to the compiler:
(EXT:EXPAND-FORM
'(EVAL-WHEN
(:COMPILE-TOPLEVEL) (foo))) ⇒; ⇒
NIL
(
T
EXT:EXPAND-FORM
'(EVAL-WHEN
(:LOAD-TOPLEVEL) (foo))) ⇒; ⇒
NIL
T
These notes document CLISP version 2.49.93+ | Last modified: 2018-02-19 |