Skip to content

Commit

Permalink
LOGIC-82: lcons with nil tail fails to unify properly
Browse files Browse the repository at this point in the history
  • Loading branch information
David Nolen authored and David Nolen committed Dec 21, 2012
1 parent cb91306 commit 0c985df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/clojure/clojure/core/logic.clj
Expand Up @@ -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)))))

;; -----------------------------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions src/test/clojure/clojure/core/logic/tests.clj
Expand Up @@ -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

Expand Down

0 comments on commit 0c985df

Please sign in to comment.