Question

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.

Was it helpful?

Solution

Your checko should work just fine for matching lists.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top