Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.unify by
Currently unify allows using sets as expressions and just uses them as sequences, which, depending on the order of items, causes the unification to fail or succeed:

(unify #{ '[aa a] '[bb b] } ; =seq=> [bb b] [aa a]
       #{ '[?a a] '[?b b] } ; =seq=> [?b b] [?a a]
) ; => {?a aa, ?b bb}

(unify #{  '[a a]  '[b b] } ; =seq=> [a a] [b b]
       #{ '[?a a] '[?b b] } ; =seq=> [?b b] [?a a]
) ; => nil, expected {?a a, ?b b}

Unify should either handle sets (not sure if the algorithm allows for that easily) or throw an IllegalArgumentException when passed a set, but not silently seq it and behave unpredictably like that.

1 Answer

0 votes
Reference: https://clojure.atlassian.net/browse/UNIFY-8 (reported by alex+import)