pattern matching - In Racket or Scheme, is there any way to convert an ellipsis syntax object to a list of syntax objects? -
for example:
(syntax-case #'(a b c d) () ((x ...) (list #'x ...))
in example, (list #'x ...)
not work, can output equivalent of (list #'a #'b #'c #'d)
?
here's 1 way of doing it:
welcome racket v5.90.0.6. -> (syntax-case #'(a b c d) () ((x ...) (syntax->list #'(x ...)))) '(#<syntax:5:16 a> #<syntax:5:18 b> #<syntax:5:20 c> #<syntax:5:22 d>)
for more, see syntax object operations section , functions exported syntax/stx
.
Comments
Post a Comment