Summary
(r7rs) syntax-rules doesn't allow combining ellipsis and dotted tail
Metadata
- Id: 462cef570befee100d0cad2bbfce3cdd5ebc1252
- Trac id: 1794
- Type: defect
- Reporter: sjamaan
- Owner:
- Cc: evhan
- Status: closed
- Component: unknown
- Estimated difficulty: medium
- Resolution: duplicate
- Priority: major
- Milestone: 6.0.0
- Version: 5.3.0
- Changetime: 2023-11-12 22:48:58 UTC
- Created: 2021-11-26 10:37:38 UTC
- Keywords: r7rs, syntax-rules, macros
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.