(hash-unordered-coll coll)
Returns the hash code, consistent with =, for an external unordered
collection implementing Iterable. For maps, the iterator should
return map entries whose hash is computed as
(hash-ordered-coll [k v]).
See http://clojure.org/data_structures#hash for full algorithms.
Source
(defn
hash-unordered-coll
"Returns the hash code, consistent with =, for an external unordered\n collection implementing Iterable. For maps, the iterator should\n return map entries whose hash is computed as\n (hash-ordered-coll [k v]).\n See http://clojure.org/data_structures#hash for full algorithms."
[coll]
(loop
[n 0 hash-code 0 coll (seq coll)]
(if-not
(nil? coll)
(recur
(inc n)
(bit-or (+ hash-code (hash (first coll))) 0)
(next coll))
(mix-collection-hash hash-code n))))