I am trying to use maps as my data structure and I initialize them to contain lvars
to be assigned values later from other relations.
This succeeds:
(run 1 [q]
(fresh [a b]
(== q {:a 1 :b 2 :c b})
(featurec q {:a b})))
-> ({:a 1, :b 2, :c 1})
But these fail:
;; 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
I am using [org.clojure/core.logic "0.8.5"]
. How can I make both goals succeed?
This is due to a bug in partial-map
(http://dev.clojure.org/jira/browse/LOGIC-145).