This is a contradiction:
(run* [q]
(== q true)
(== q false))
-> ()
Because there can't be a q that is true
and false
at the same time.
Shouldn't this be a contradiction as well?
(run* [q]
(featurec q {:k true})
(featurec q {:k false}))
-> ((_0 :- (clojure.core.logic/featurec _0 {:k true})
(clojure.core.logic/featurec _0 {:k false})))
I don't know what that :-
mean. But since map keys are unique, I suppose there cannot be a map that can have :k
to be true
as well as false
. How can I make sure the second goal doesn't match?
Another Example
(run* [q]
(fresh [x]
(featurec x {:k false})
(== q true)
(featurec x {:k q}))) -> (true)
I am interpreting this as:
x
is a map-like with:k
asfalse
.q
istrue
.q
is the value of:k
ofx
What am I trying to do exactly?
I am trying to use featurec
to create goals like:
(defn is-a-foo [x v]
(featurec x {:foo v}))
(defn is-a-bar [x v]
(featurec x {:bar v}))
Then I'd like to be able to say:
(defn foo-implies-bar [x]
(conde [(is-a-foo [x true]) (is-a-bar [x true])])