Permalink
Browse files

LOGIC-82: lcons with nil tail fails to unify properly

  • Loading branch information...
1 parent cb91306 commit 0c985df0236037907852f9b19c7df3ba6a607875 David Nolen committed Dec 21, 2012
Showing with 11 additions and 1 deletion.
  1. +3 −1 src/main/clojure/clojure/core/logic.clj
  2. +8 −0 src/test/clojure/clojure/core/logic/tests.clj
@@ -1514,7 +1514,9 @@
nil)
(unify s u v))
(if (lvar? u)
- (unify s u '())
+ (if-let [s (unify s u '())]
+ s
+ (unify s u nil))
nil)))))
;; -----------------------------------------------------------------------------
@@ -1286,6 +1286,14 @@
(== q (lcons x y)))))
(into #{} [(lcons 1 '_0) (lcons 2 '_0) (lcons 3 '_0)]))))
+(deftest test-82-nil-lcons-tail
+ (is (= (run 1 [q]
+ (fresh [a b c]
+ (conso a b c)
+ (== b nil)
+ (== `(~a) c)))
+ '(_0))))
+
;; =============================================================================
;; cKanren

0 comments on commit 0c985df

Please sign in to comment.