[LOGIC-67] match(e/a) in ClojureScript always creates free var Created: 14/Nov/12 Updated: 14/Nov/12 Resolved: 14/Nov/12 |
|
| Status: | Resolved |
| Project: | core.logic |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Thomas Karolski | Assignee: | David Nolen |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
cljsbuild 0.2.8 |
||
| 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. (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? |
| Comments |
| Comment by David Nolen [ 14/Nov/12 5:52 PM ] |
|
fixed, http://github.com/clojure/core.logic/commit/fff0033b288a2ff80ce3bc672e1daabfa16e555b |