Use `~@` (sine Racket 7.0): (syntax-parse #'(1 2 2 a 2 2 b 2 c) [(1 (~seq n:nat ...+ x) ...) #'((~@ n ... x) ...)])
-Philip On Sat, Sep 21, 2019 at 4:15 PM Jonathan Simpson <jjsim...@gmail.com> 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? > > If could get a syntax class that replaces the (~seq n:nat ...+ x) that > might work but I haven't been able to get a syntax class that will do that > either. > > Thanks, > Jonathan > > -- > 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/55b38c69-a789-4528-be79-0bf48c97f283%40googlegroups.com > <https://groups.google.com/d/msgid/racket-users/55b38c69-a789-4528-be79-0bf48c97f283%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAH3z3gbJiV8usq3_cfWywdXzyLQPN6xvVTrcb5pJJVKZKpKe2g%40mail.gmail.com.