This is a quick handout to help you with debugging macros.
If you’re working with DrRacket, then there is a macro stepper button in the toolbar. When you click it, you’ll get a new window showing macro expansion steps. Note that Racket itself is full of macros, so you’ll generally want to click the option to hide library macros. I’m not sure that you can get it to work sanely though.
Another option is to use the Racket console REPL. Here’s a rough sketch of how you’d do it:
cd
into the directory holding your file.racket
, the command-line REPL.pushdown
expression, and not (define foo (pushdown ...))
so we focus on the
expansion of the macro and not whatever define
expands to.),stx +
. If you enter it again, you get another expansion step
etc. You probably won’t need to go beyond the first step or few steps.,stx
command in the docs for
it.#lang pl
etc.)