Opened 12 months ago

Last modified 12 months ago

#1794 new defect

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

Reported by: sjamaan Owned by:
Priority: major Milestone: 5.4
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 (1)

comment:1 Changed 12 months 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.

Note: See TracTickets for help on using tickets.