function | since v1.9.655 | Edit |
(equiv-map x y)
Test map equivalence. Returns true if x equals y, otherwise returns false.
(defn equiv-map
[x y]
(boolean
(when (and (map? y) (not (record? y)))
; assume all maps are counted
(when (== (count x) (count y))
(if (satisfies? IKVReduce x)
(reduce-kv
(fn [_ k v]
(if (= (get y k never-equiv) v)
true
(reduced false)))
true x)
(every?
(fn [xkv]
(= (get y (first xkv) never-equiv) (second xkv)))
x))))))