[Scheme-reports] Question regarding interaction between new syntax-rules extensions Peter Bex (25 May 2013 12:22 UTC)

[Scheme-reports] Question regarding interaction between new syntax-rules extensions Peter Bex 25 May 2013 12:21 UTC

Hello list,

This may be a very basic question, but I'm currently unable to figure
out what the interaction between syntax-rules literals, custom ellipsis
identifiers and underscores should behave like, or whether the behaviour
is defined at all.

For example, it's clear that underscores lose their special meaning
when they're part of the literals list (this is explicitly noted in
the text), but what should happen when the underscore is chosen as
the ellipsis identifier?

(define _ 'underscore)
(define-syntax match-ellipsis-underscores
  (syntax-rules _ ()
      ((x a _ c) (list a _ c))))

(match-ellipsis-underscores 1) => (1), or error?
(match-ellipsis-underscores 1 2 3) => (1 underscore 3), or (1 2 3)
(match-ellipsis-underscores 1 2 3 4 5 6) => (1 2 3 4 5 6) or error?

And what happens when mixing literals with ellipsis identifiers?

(define ___ 2)
(define-syntax match-ellipsis-literals
  (syntax-rules ___ (___)
    ((_ x ___) (list x ___))))

(match-ellipsis-literals 1) => (1 2), (1 underscore), or (1)?
(match-ellipsis-literals 1 2) => (1 2), (1 underscore), or error?
(match-ellipsis-literals 1 ___) => (1 underscore), error?

Cheers,
Peter
--
http://www.more-magic.net

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports