matche on lists

250 views Asked by At

I wonder if I can use something like matche to do pattern matching with a list in core.logic

With vectors something like

=> (defn checko [code r] (matche [code] ([['foo ?a ?b]] (== r [?a ?b]))))
=> (run* [q] (checko [:foo :u 2] q))
  ([:u 2])

works pretty well, but I could not figure out how to match a list (foo :u 2) instead of a vector. The reason is that I want to analyze clojure programs using core.logic.

2

There are 2 answers

1
dnolen On BEST ANSWER

Your checko should work just fine for matching lists.

0
amalloy On

In case assurances from the author himself are not sufficient, I have used core.match and vector patterns match lists (and indeed seqs in general) just fine - that's what they're supposed to do.