<div dir="ltr"><div>I'm interested in a layered approach to learning the macro system, which makes a lot of sense from a learning point of view.<br></div><div><br></div><div>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:</div>

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

<div>    e-body))</div><div><br></div><div>> (block ((x 1) (y 2)) (+ x y))</div><div>((x 1) (y 2))</div><div>3</div><div><br></div><div>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.</div>

<div><br></div><div>I guess I'm after How to Design Macros. ;-)</div><div><br></div><div>Dan</div></div></div>