Common Lisp recursive macro expansion
Slime has a code-walking slime-macroexpand-all
command: http://common-lisp.net/project/slime/doc/html/Macro_002dexpansion.html
This is probably undocumented and/or unsupported, but maybe you can call it from the REPL:
CL-USER> (swank-backend:macroexpand-all '(my-recursive-fact 5))
(* 5 (* 4 (* 3 (* 2 (* 1 1)))))
MACROEXPAND
takes a form and expands it. It does it multiple times until the form is no longer a macro form.
In your example, the top level call to my-recursive-fact
is a macro form. The result form with the multiplication in front is not a macro form, since *
is not a macro. It is a function. The form has an argument, which is a macro form. But MACROEXPAND
does not look at those.
If you want to expand code on all levels, you need to use a code walker. Some Lisps have it in the IDE directly accessible, like Lispworks.