core-logic

abdullahibra 2016-09-29T14:05:00.000003Z

hi guys

abdullahibra 2016-09-29T14:06:04.000004Z

why can't i do this? (run* [q1 q2] (= q1 (* q2 q2))) ?

abdullahibra 2016-09-29T14:06:37.000005Z

i got this: ClassCastException clojure.core.logic.LVar cannot be cast to java.lang.Number clojure.lang.Numbers.multiply (Numbers.java:148)

abdullahibra 2016-09-29T14:07:23.000006Z

user=> (run* [q1] (== q1 1)) (1)

abdullahibra 2016-09-29T14:08:06.000007Z

user=> (run* [q1 q2] (= q1 q2 1)) ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn clojure.core.logic.Substitutions (logic.clj:425)

abdullahibra 2016-09-29T14:09:35.000008Z

oh == is unification which is different

abdullahibra 2016-09-29T14:10:18.000009Z

(run* [q1 q2] (== [3 q1] [q2 2])) ([2 3])

abdullahibra 2016-09-29T14:10:28.000010Z

got it