JRR
JRR

Reputation: 6152

syntax for unsyntax in syntax-parse

can someone point me to how I can write this in syntax-parse/case?

[(list e ...) #`(list #,(f #'e) ...)]

basically I'd like each element in the list to be processed individually by f in unsyntax. I don't think the above is the right syntax?

Upvotes: 0

Views: 70

Answers (1)

user4003407
user4003407

Reputation: 22102

You can use unsyntax-splicing (which can be abbreviated as #,@) to embed result of list returning expression as individual elements of outer list. Then you can use map procedure to apply f over all elements of list returned by (syntax->list #'(e ...)) expression. In the end it will look like this:

#`(list #,@(map f (syntax->list #'(e ...))))

Upvotes: 1

Related Questions