Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CLJ-1348 - add hash-ordered-coll and hash-unordered-coll

Signed-off-by: Stuart Halloway <>
  • Loading branch information...
commit 89dd5d5150948d0f1f3bd6ea57d9667885076ca8 1 parent 21a7603
@puredanger puredanger authored Stuart Halloway committed
Showing with 19 additions and 0 deletions.
  1. +19 −0 src/clj/clojure/core.clj
19 src/clj/clojure/core.clj
@@ -4694,6 +4694,7 @@
:static true}
[x] (. clojure.lang.Util (hasheq x)))
(defn mix-collection-hash
"Mix final collection hash for ordered or unordered collections.
hash-basis is the combined collection hash, count is the number
@@ -4704,6 +4705,24 @@
:static true}
[^long hash-basis count] (clojure.lang.Murmur3/mixCollHash hash-basis count))
+(defn hash-ordered-coll
+ "Returns the hash code, consistent with =, for an external ordered
+ collection implementing Iterable.
+ See for full algorithms."
+ {:added "1.6"
+ :static true}
+ [coll] (clojure.lang.Murmur3/hashOrdered coll))
+(defn hash-unordered-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 for full algorithms."
+ {:added "1.6"
+ :static true}
+ [coll] (clojure.lang.Murmur3/hashUnordered coll))
(defn interpose
"Returns a lazy seq of the elements of coll separated by sep"
{:added "1.0"
Please sign in to comment.
Something went wrong with that request. Please try again.