Follow

I'd like some recommendations for tutorials on macros. syntax-rules for sure, but beyond that, er- and ir-transformers, or syntax-case, it's all up for grabs.

The motivation is to try to encourage colleagues to move beyond defmacro.

What I've collected so far:
"Fear of Macros" covering syntax-rules, syntax-case and parse-syntax greghendershott.com/fear-of-ma

"Mini-tutorial on explicit (and implicit) renaming macros in CHICKEN" wiki.call-cc.org/explicit-rena

An old and now out-of-date in parts post to chicken-users about macro systems covering sc-, rsc- and er-macro-transformer, and touches on syntax-case. lists.gnu.org/archive/html/chi

The blog post @erkin is working on, which looks like it'll be great.

@tfb
I'm writing a blogpost about the differences between Scheme macro models right now! Would you be interested in giving me C&C?

@erkin I sometimes program in strict C89 because that's fun and sufficient and the thought of portability support is cool. If I learned r5rs and say fuck off to 6 and 7, am I sealing my demise or is it as cool as C89?

@byllgrim R5RS is cool and good, and (mostly) forward compatible with R6RS and R7RS, but it's very limited in scope and you'll be relying on implementation-specific libraries for the most part.

@erkin @byllgrim If you can do what you need with R5RS, you'll be fine. It's really just the core language, though.

@erkin That sounds great, I'd love to read a draft or notes or whatever you have 👍

@erkin
Here's a version annotated with feedback. Some about presentation, a few technical points. My comments are all bracketed by [[ and ]]

0x0.st/zxhi.txt

@tfb Much appreciated! I totally agree with your comments and I'll update the post accordingly.

@tfb I don't have tutorial but showing the definition of `define-syntax-rule` and how to use will prolly help. See git.sr.ht/~amz3/arew-scheme/tr

It really looks like defmacro to me.

@zig Yeah, I'm looking for a collection of things that are more accessible than specs, reference docs, or just code.

So far I have "Fear of Macros" and the Chicken user guide, which is remarkably accessible.

@rain
Indeed, that one is great 👍. It and Juergen Lorenz's tutorial on Chicken macros wiki.call-cc.org/explicit-rena were what I had gathered by looking on my own.

@tfb Here's what I collected during my search for related works:

CHICKEN also has a wiki page for procedural macros in general: wiki.call-cc.org/eggref/5/proc

Scheme Wikibook's section on macros is a tad dated but it comes with a decent comparison `define-macro` with `syntax-rules`.
en.wikibooks.org/wiki/Scheme_P

JRM's primer on `syntax-rules` is *the* most comprehensive document on `syntax-rules` I've come across: hipster.home.xs4all.nl/lib/sch

Sign in to participate in the conversation
Functional Café

functional.cafe is an instance for people interested in functional programming and languages.