[racket] Macro Help

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Sun Feb 26 20:39:20 EST 2012

Helmut Rohrbacher wrote at 02/26/2012 07:18 PM:
> What macro voodoo do I need to harness in order to be able to 
> implement the first definition syntax where the /args ... -> 
> body/ segments need not be wrapped in parens?

I think that the difficulty is due to using old "syntax-rules".  
Nowadays, "syntax-rules" is a hobby for the patient, like building model 
ships in bottles.

I suggest forgetting about "syntax-rules", and using Ryan Culpepper's 
"syntax-parse" instead.

With "syntax-parse", be sure to look at the documentation for splicing 
syntax classes.

Don't be intimidated by the large documentation on "syntax-parse" -- 
"syntax-parse" is a very nice tool, and is worth learning if you are 
doing anything that isn't trivial in "syntax-rules".

Alternatively, you could also do your "function" macro in "syntax-case", 
which is a big step up from "syntax-rules", but "syntax-parse" is an 
even better friend.

P.S., If you really want to use "syntax-rules", then Joe Marshall's 
"syntax-rules" primer teaches enough that you can figure out how to 
implement your "function" macro.  
http://hipster.home.xs4all.nl/lib/scheme/gauche/define-syntax-primer.txt

-- 
http://www.neilvandyke.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120226/a5c8af94/attachment-0001.html>

Posted on the users mailing list.