Summary

(r7rs) syntax-rules doesn't allow combining ellipsis and dotted tail

Metadata

Description

According to the R7RS spec, the following should match:

 (define-syntax match-ellipsis-and-dotted-tail1
   (syntax-rules ()
     ((_ a ... . b)
      '(a ... b))))
 
 (print (match-ellipsis-and-dotted-tail1 x y . z))

And this, too:

 (define-syntax match-ellipsis-and-dotted-tail2
   (syntax-rules ()
     ((_ (a) ... . (b))
      '(a ... b))))
 
 (print (match-ellipsis-and-dotted-tail2 (x) (y) z))

Both should print `(x y z)`.

Might be nice to support this in the core `syntax-rules`, or if it's too tricky, we could just support it only in the R7RS egg.

Changes and comments

[2021-11-26 10:53:38 UTC] sjamaan wrote:

NOTE: seems to be a duplicate of #1736 which claims this was already part of SRFI 46, so I think we should try and support it in core.

[2023-11-06 22:13:30 UTC] felix changed milestone from 5.4 to 6.0.0

[2023-11-12 22:48:58 UTC] felix changed status from new to closed

[2023-11-12 22:48:58 UTC] felix set resolution to duplicate