[racket] Macros baffle me

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Thu May 1 21:34:38 EDT 2014

Three tips for this problem:

* Don't use "eval".

* For the pattern-matching part of your syntax transformers, use only 
"syntax-case" or "syntax-parse".  "syntax-rules" and 
"define-syntax-rule" might get in the way, and block and frustrate you, 
for no good reason.

* Do experiments in DrRacket's Interactions pane to get familiar with 
how s-expressions and syntax objects are different, and sometimes 
intermixed, and how you need to use procedures like "syntax->datum" and 
"syntax->list" to get into the syntax objects sometimes.  (You need 
don't need to do this as much with "syntax-parse" as you do with 
"syntax-case", but it's still good to understand.)

Neil V.


Posted on the users mailing list.