JRR
JRR

Reputation: 6152

matching lists in syntax-parse

how can I match a list in syntax parse? I tried this code:

(syntax-parse #'(1 2)
  [(list a b) (printf "a: ~a~n") #'a])

but doesn't seem to work. I'm assuming '(1 2) is a list in racket?

Upvotes: 1

Views: 112

Answers (1)

soegaard
soegaard

Reputation: 31147

The pattern syntax of syntax-parse and match are different.

Try:

(syntax-parse #'(1 2)
    [(a b) (printf "a: ~a~n" #'a)])

Upvotes: 1

Related Questions