Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

LOGIC-88: disequality reification is broken

Was not emitting the entire prefix was all.
  • Loading branch information...
commit 5a0eb2754dc744e60ea1c4ea3460b5429685ef59 1 parent f973b36
@swannodette swannodette authored
View
2  src/main/clojure/clojure/core/logic.clj
@@ -3921,7 +3921,7 @@
(not (or (var? lhs)
(var? rhs))))
p*)]
- `(~'!= ~@(first p*))))))
+ `(~'!= ~@p*)))))
IConstraintOp
(rator [_] `!=)
(rands [_] (seq (recover-vars p)))
View
15 src/test/clojure/clojure/core/logic/tests.clj
@@ -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]
@@ -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])
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.