Fork me on GitHub

@paulocuneo have you signed the contributor agreement?


in core.logic, considering i have a map as a logic variable, is it it possible to compare to the value of a specific keyword? i thought about doing it like this, but it doesn't work:

(logic/run* [q]
(logic/membero q [{:id 1 :name "foo"} {:id 2 :name "bar"} {:id 3 :name "foo"}])
(logic/== (:name q) "foo"))
=> ()
the only solution i found was to compare the logic variable to a map and adding logic variables to the values i don't know
(logic/run* [q x]
(logic/membero q [{:id 1 :name "foo"} {:id 2 :name "bar"} {:id 3 :name "foo"}])
(logic/== q {:id x :name "foo"}))
=> ([{:id 1, :name "foo"} 1] [{:id 3, :name "foo"} 3])


I use featurec (I think that is the name of the thing)


it works! thanks @hiredman!


(logic/run* [q]
  (logic/membero q [{:id 1 :name "foo"} {:id 2 :name "bar"} {:id 3 :name "foo"}])
  (logic/featurec q {:name "foo"}))
=> ({:id 1, :name "foo"} {:id 3, :name "foo"})

dominicm20:12:07 I'm trying to do something similar to this. Except, I want to potentially build the query based on other lvars. I'm not certain this makes sense as a question. How can I get a list of potential candidate values for an lvar at a the point of my query?


I pretty much just want to know "oh, it's one of these numbers? I'll grab data for them" vs "Could be anything? I'll grab it all" Might be nice to have some assertions in cases where I can only grab it with some constraint.


That sounds very similar to my actual end goal, so probably a perfect example.


(or maybe the original that was forked from)