On 9/21/19 10:15 PM, Jonathan Simpson wrote:
Given this macro that I'm experimenting with:

(syntax-parse #'(1 2 2 a 2 2 b 2 c) [(1 (~seq n:nat ...+ x) ...) #'((n ... x) ...)])

How would I change it so that it returns #'(2 2 a 2 2 b 2 c) instead of #'((2 2 a) (2 2 b) (2 c)) ?

I don't want the parens around the individual sequences that I'm matching, but I haven't figured out a way to do this without using a pattern that forces me to add them in the body of the syntax-parse clause. How can I group the n and x pattern variables in the body without adding parens around them?

Use `~@` in the template:

  #'((~@ n ... x) ...)

Ryan

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/e0b92a23-9652-3059-b354-cdb50fee9f3b%40ccs.neu.edu.

Reply via email to