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?
Depending on the Scheme system in question (and depending on which high-level macro systems it supports), its expander is not just a function from Scheme datums (representing programs) to Scheme datums (representing expanded programs).
For example, in a typical Scheme that supports "syntax-case", the input to its expander is a syntax object and the output does not need to be represented by a Scheme datum but could be in any AST format.
Furthermore, Scheme systems differ in their opinion what core forms are. One system's expander will, for example, desugar "let", another system's expander won't.
Thus, I don't think that it is possible to spec a function like "macroexpand" that works across many Scheme systems, nor do I think that one should strive for when it places restrictions on how the expanders of Scheme systems have to work.
Marc
P.S.: I hope I didn't misunderstand your question.