I'm having difficulty following along with some of the GNU guile manual's documentation on macros (https://www.gnu.org/software/guile/manual/guile.pdf) :
In section 6.10.2.1 (pg 259 on Patterns), there's a section talking about how improper lists are matched like the elipsis keyword:
(define-syntax let1
(syntax-rules ()
((_ (var val) . exps)
(let ((var val)) . exps))))
Then saying how this is non-desirable because non-list exps
like in (let (foo 'bar) . baz))
will be matched. However, I can't get that expression to expand. The following expressions do expand, though:
(let1 (foo 'bar) . (baz))
→(let (foo 'bar) baz)
(let1 (foo 'bar) baz)
→(let (foo 'bar) baz)
Similarly in the following discussion on the improvement:
(define-syntax let1
(syntax-rules ()
((_ (var val) exp ...)
(let ((var val)) exp ...))))
It states that (let1 (foo 'bar))
will be matched, which I once again can't get to match. I can get this to, though:
(let1 (foo 'bar) baz)
→(let (foo 'bar) baz)
Before bashing my head against the wall any further, it would be great if someone can clarify how the improper and elipsis pattern matching worked (and whether there's a typo in the documentation, or something wrong with my Guile installation/macro expansion methodology?). I'm using Guile 2.0.9 (docs are on 2.0.11 but wouldn't have thought this would matter so much), and I'm using Geiser, as well as this guide for macro expansion (no difference in result):
ice-9/psyntax.scm:1101:54: In procedure expand-top-sequence:
ice-9/psyntax.scm:1101:54: Syntax error:
unknown location: let: bad let in form (let ((foo (quote bar))))
In ice-9/psyntax.scm:
1101:54 0 (expand-top-sequence ((let2 (foo (quote bar)))) () ((top)) ...)
Thanks! Also, if anyone can recommend any other good, less terse resources on Scheme (preferentially in Guile) macros that would be great as well!