core-logic

noprompt 2017-12-14T15:58:31.000492Z

@paulocuneo have you signed the contributor agreement?

paulocuneo 2017-12-22T02:07:07.000110Z

now I have

2017-12-14T18:44:36.000232Z

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])

2017-12-14T19:14:18.000186Z

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

2017-12-14T19:17:15.000300Z

it works! thanks @hiredman!

2017-12-14T19:17:21.000393Z

(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"})

dominicm 2017-12-14T20:36:07.000593Z

https://stackoverflow.com/a/14532781 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?

dominicm 2017-12-14T20:36:47.000650Z

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.

2017-12-14T20:40:09.000452Z

you might look at https://github.com/hiredman/jiralog

dominicm 2017-12-14T20:41:00.000093Z

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

2017-12-14T20:41:56.000034Z

I think maybe I started from https://gist.github.com/terjesb/3181018

2017-12-14T20:42:11.000443Z

(or maybe the original that was forked from)