Skip to content

Commit 89dd5d5

Browse files
puredangerstuarthalloway
authored andcommitted
CLJ-1348 - add hash-ordered-coll and hash-unordered-coll
Signed-off-by: Stuart Halloway <[email protected]>
1 parent 21a7603 commit 89dd5d5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/clj/clojure/core.clj

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4694,6 +4694,7 @@
46944694
:static true}
46954695
[x] (. clojure.lang.Util (hasheq x)))
46964696

4697+
46974698
(defn mix-collection-hash
46984699
"Mix final collection hash for ordered or unordered collections.
46994700
hash-basis is the combined collection hash, count is the number
@@ -4704,6 +4705,24 @@
47044705
:static true}
47054706
[^long hash-basis count] (clojure.lang.Murmur3/mixCollHash hash-basis count))
47064707

4708+
(defn hash-ordered-coll
4709+
"Returns the hash code, consistent with =, for an external ordered
4710+
collection implementing Iterable.
4711+
See http://clojure.org/data_structures#hash for full algorithms."
4712+
{:added "1.6"
4713+
:static true}
4714+
[coll] (clojure.lang.Murmur3/hashOrdered coll))
4715+
4716+
(defn hash-unordered-coll
4717+
"Returns the hash code, consistent with =, for an external unordered
4718+
collection implementing Iterable. For maps, the iterator should
4719+
return map entries whose hash is computed as
4720+
(hash-ordered-coll [k v]).
4721+
See http://clojure.org/data_structures#hash for full algorithms."
4722+
{:added "1.6"
4723+
:static true}
4724+
[coll] (clojure.lang.Murmur3/hashUnordered coll))
4725+
47074726
(defn interpose
47084727
"Returns a lazy seq of the elements of coll separated by sep"
47094728
{:added "1.0"

0 commit comments

Comments
 (0)