Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
LOGIC-88: disequality reification is broken
Was not emitting the entire prefix was all.
  • Loading branch information
swannodette committed Jan 3, 2013
1 parent f973b36 commit 5a0eb27
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/clojure/clojure/core/logic.clj
Expand Up @@ -3921,7 +3921,7 @@
(not (or (var? lhs)
(var? rhs))))
p*)]
`(~'!= ~@(first p*))))))
`(~'!= ~@p*)))))
IConstraintOp
(rator [_] `!=)
(rands [_] (seq (recover-vars p)))
Expand Down
15 changes: 11 additions & 4 deletions src/test/clojure/clojure/core/logic/tests.clj
Expand Up @@ -804,14 +804,14 @@
(fresh [x]
(!= x 1)
(== q x)))
'((_0 :- (!= _0 1))))))
'((_0 :- (!= (_0 1)))))))

(deftest test-disequality-2
(is (= (run* [q]
(fresh [x]
(== q x)
(!= x 1)))
'((_0 :- (!= _0 1))))))
'((_0 :- (!= (_0 1)))))))

(deftest test-disequality-3
(is (= (run* [q]
Expand Down Expand Up @@ -925,9 +925,9 @@
(== q [x y])
(!= x 1)
(!= y 2)))
'(([_0 _1] :- (!= _1 2) (!= _0 1))))))
'(([_0 _1] :- (!= (_1 2)) (!= (_0 1)))))))

(deftest test-disequalilty-16
(deftest test-disequality-16
(is (= (run* [q]
(fresh [x y z]
(== y [z])
Expand All @@ -936,6 +936,13 @@
(== x ['foo])))
'())))

(deftest test-disequality-17
(is (= (run* [q]
(fresh [x y]
(!= [1 x] [y 2])
(== q [x y])))
'(([_0 _1] :- (!= (_0 2) (_1 1)))))))

;; -----------------------------------------------------------------------------
;; tabled

Expand Down

0 comments on commit 5a0eb27

Please sign in to comment.