Opened 2 years ago

Closed 5 months ago

#1794 closed defect (duplicate)

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

Reported by: sjamaan Owned by:
Priority: major Milestone: 6.0.0
Component: unknown Version: 5.3.0
Keywords: r7rs, syntax-rules, macros Cc: evhan
Estimated difficulty: medium

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.

Change History (3)

comment:1 Changed 2 years ago by sjamaan

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.

comment:2 Changed 5 months ago by felix winkelmann

Milestone: 5.46.0.0

comment:3 Changed 5 months ago by felix winkelmann

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.