Custom ellipsis identifier in syntax-rules

30 views
Skip to first unread message

Michał Pociecha-Łoś

unread,
May 2, 2024, 7:48:14 PMMay 2
to chez-scheme
ChesScheme does not implement custom ellipsis identifier in syntax-rules, as defined by SRFI 46, so it's not possible to define nested syntax with ellipsis inside the inner one:

(define-syntax outer
  (syntax-rules ()
    ((_ $id)
      (define-syntax $id
        (syntax-rules ()
          ((_ $x ...) (list $x ...)))))))

How can I implement support for custom ellipsis in ChezScheme? Is it even possible?

Best,
Michał

Marc Nieper-Wißkirchen

unread,
May 3, 2024, 3:11:05 AMMay 3
to chez-scheme
In your example, you can replace the inner ellipses with (... ...). See the be-like-begin example in section 11.19 of the R6RS.

You don't need SRFI 46 to output literal ellipses. In R7RS, it is needed in some cases when you want to match against ellipses. In R6RS, you just use syntax-case in these cases.

If you want to use SRFI 46's syntax-rules in Chez Scheme nevertheless, you can use my implementation of R7RS syntax-rules as a portable R6RS library ([1]).

Best,

Marc

--

Michał Pociecha-Łoś

unread,
May 3, 2024, 5:00:51 AMMay 3
to chez-scheme
Thank you, that's exactly what I was looking for.
Michał

Reply all
Reply to author
Forward
0 new messages