10 Dec 2006 21:37
Re: Vector patterns in syntax-rules
David Van Horn <dvanhorn <at> cs.brandeis.edu>
2006-12-10 20:37:07 GMT
2006-12-10 20:37:07 GMT
Emilio Lopes wrote:
> Hello,
>
> Scheme 48 barks at this:
>
> 226> (define-syntax foobar
> (syntax-rules ()
> ((foobar #(v ...))
> (list v ...))))
>
> Warning: too many ...'s
> (v ...)
> (&syntax-error)
> #{Unspecific}
This warning is indicating that the ellipsis used in the template has no
corresponding ellipsis in the pattern, hinting at the fact that the v
and ellipsis in #(v ...) are being interpreted literally, rather than as
a pattern variable and pattern ellipsis, as they should.
If we change the example to:
(define-syntax foobar
(syntax-rules ()
((foobar #(v ...)) #t)))
the warning goes away, and we can see how this macro is (incorrectly)
being interpreted:
(foobar #(1 2 3)) => syntax error
(Continue reading)
RSS Feed