Details
-
Type:
Defect
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:cljsbuild 0.2.8
core.logic 0.8.0-beta2
Description
The following code:
(defn map-geto* [m k v]
(matche [m]
([[[k v] . _]])
([[_ . tail]] (map-geto* tail k v))))
(run* [q] (map-geto* (seq {:title "Blub" }) :title q))
works in Clojure as expected, returning ("Blub"). However in ClojureScript I get (_.0) instead. From what I can tell, this is because within the matche clause that matches [k v], both k and v are not being matched against the upper k and v, but rather create fresh variables instead.
I can work around the issue by writing the following:
(defn map-geto* [m k v]
(matche [m]
([[[k' v'] . _]] (== k k') (== v v'))
([[_ . tail]] (map-geto* tail k v))))
(run* [q] (map-geto* (seq {:title "Blub" }) :title q))
Is this intended behavior?
fixed, http://github.com/clojure/core.logic/commit/fff0033b288a2ff80ce3bc672e1daabfa16e555b