In Guix there's a layer made of macros beautifying the creation and manipulation of srfi-9 records
The code is in guix/records.scm
The code is large and articulated
I thought to expand those macros to see their input and their output in order to have a feel of what they do
The thing is that even the standard vanilla srfi-9 records are macros around structures, in their own turn
So the macro expansion gives me a completely expanded code creating and manipulating structures.
I'd prefer to see the result of a single pass of macro expansion, to see what srfi-9 code the guix macros have produced
In Clojure there are macroexpand
and macroexpand-1
macroexpand-1
does a single pass of macro expansion and macroexpand
calls macroexpand-1
repeatedly until there are no more macors to expand in the forms being processed
You can see this here
Is there a similar option in Guile scheme ?
Am I missing any workflow trick, any tool, any library function or macro for dealing with this ?
Here is a simple version of
macroexpand1
:The output is:
Note that Clojure's macro expansion algorithm is more simplistic than what's used in most Scheme implementation.
For an explanation
psyntax
aka portable syntax-case look in the book "Beautiful Code" for the chapter by Dybvig.https://www.cs.indiana.edu/~dyb/pubs/bc-syntax-case.pdf