clojure - core.logic unification matches value in map but not key -
i don't understand why following 2 examples, first 1 returns correct value (1), while second returns (). i'd have expected result (:key) or exception can't find solution, not empty list.
(l/run* [q] (l/== {:key 1} {:key q})) ;; doesnt work (l/run* [q] (l/== {:key 1} {q 1}))
i haven't found documented intended behaviour or not, looking @ source code, (limited) understanding, looks unification of maps happens values, not keys.
as implemented in unify-with-map*, when core.logic finds key :key in first map, looks value in second, doesn't find it, , bails on unification. since there no solutions, @arthur ulfeldt said, end ().
Comments
Post a Comment