[racket] Formal Presentation and initial doubts.

From: Daniel Prager (daniel.a.prager at gmail.com)
Date: Sat Mar 22 22:58:49 EDT 2014

I'm interested in a layered approach to learning the macro system, which
makes a lot of sense from a learning point of view.

I was able to get Matthias's example(s) to work with the aid of DrRacket
and a little guesswork (at the level of pattern-matching) to fix the typos,
and trivially extended it to get this:

(define-syntax-rule
  (block ((x e-rhs) ...) e-body)
 ;; -->
  (letrec ((print-all (lambda (x ...) (displayln `((x ,x) ...)))) (x e-rhs)
...)
    (print-all x ...)
    e-body))

> (block ((x 1) (y 2)) (+ x y))
((x 1) (y 2))
3

What might be useful to those of us starting out is some kind of
learning-by-doing approach, perhaps divided into lots of examples
stratified by layer of sophistication. E.g. Write a macro to do X, what
does macro Y do?, extend X to do something else, fix the defect in macro Z.

I guess I'm after How to Design Macros. ;-)

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140323/4ac68ce4/attachment.html>

Posted on the users mailing list.