我正在尝试使用地图作为我的数据结构,并将其初始化为包含lvars
,以便稍后从其他关系中分配值。
这成功了:
(run 1 [q]
(fresh [a b]
(== q {:a 1 :b 2 :c b})
(featurec q {:a b})))
-> ({:a 1, :b 2, :c 1})
但这些失败了:
;; Expected result -> ({:a 1 :b 2 :c _0})
(run 1 [q]
(fresh [a b]
(== q {:a a :b 2 :c b})
(featurec q {:a 1})))
-> java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentMap
;; Expected result -> ({:a _0 :b 2 :c _0})
(run 1 [q]
(fresh [a b]
(== q {:a a :b 2 :c b})
(featurec q {:a b})))
-> java.lang.ClassCastException: clojure.core.logic.LVar cannot be cast to clojure.lang.IPersistentMap
我正在使用[org.clojure/core.logic "0.8.5"]
。我怎样才能使这两个目标成功?