On Thu, Oct 3, 2019 at 8:30 AM Lassi Kortela <xxxxxx@lassi.io> wrote:
Has someone here by chance written a pre-SRFI for macroexpand (or
macro-expand, syntax-expand, etc.)? Would be nice to have a standard way
to find out what code your macros expand to.

Since Scheme has several macro systems (syntax-rules, syntax-case,
CL-style define-macro, maybe others?) does that complicate the interface
of a macroexpander, or is the complexity all in the internals?

As Marc points out, that sounds like a hard task, especially given the variety of approaches different Scheme implementations take to macros.

Under MIT Scheme, what I do is evaluate (pp (lambda () <macro-definition>)).  That pretty prints the expanded form without executing it.  Given a pretty printer or some other means of printing the sources of a procedure, I wouldn't be surprised if that worked on other implementations.