From 63a980557fc7c644a3e9e37e2275f4e9f59580e6 Mon Sep 17 00:00:00 2001 From: Nada Amin Date: Wed, 19 Dec 2012 00:16:17 +0100 Subject: [PATCH] anoter issue with cKanren, related to suspensions --- .../clojure/clojure/core/logic/nominal/tests.clj | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/clojure/clojure/core/logic/nominal/tests.clj b/src/test/clojure/clojure/core/logic/nominal/tests.clj index 1314d05a..fbbf61bc 100644 --- a/src/test/clojure/clojure/core/logic/nominal/tests.clj +++ b/src/test/clojure/clojure/core/logic/nominal/tests.clj @@ -263,6 +263,18 @@ (infd x (interval 1 3)) (== [x y] q)))) '([1 1] [2 2] [3 3]))) + (is (= (run* [q] + (nom/fresh [a b] + (fresh [x y] + (== (nom/tie a (nom/tie b [b y])) (nom/tie b (nom/tie a [a x]))) + ;; TODO(namin): unfortunately, unifying with y instead of x generates a class cast exception: + ;; clojure.core.logic.nominal.Suspension cannot be cast to java.lang.Number + ;; at clojure.core.logic.IntervalFD.member_QMARK_ (logic.clj:525) + ;; commenting out next constraint, and adding following to get intended result + ;; (infd y (interval 1 3)) + (infd x (interval 1 3)) + (== [x y] q)))) + '([1 1] [2 2] [3 3]))) (is (= (run* [q] (nom/fresh [a b] (fresh [x y]