|
1198 | 1198 | (next coll))
|
1199 | 1199 | (mix-collection-hash hash-code n))))
|
1200 | 1200 |
|
1201 |
| -(def ^:private empty-ordered-hash |
1202 |
| - (mix-collection-hash 1 0)) |
| 1201 | +(def ^{:private true :jsdoc ["@type {*}"]} |
| 1202 | + EMPTY_ORDERED_HASH nil) |
| 1203 | + |
| 1204 | +(defn- empty-ordered-hash [] |
| 1205 | + (when (nil? EMPTY_ORDERED_HASH) |
| 1206 | + (set! EMPTY_ORDERED_HASH (mix-collection-hash 1 0))) |
| 1207 | + EMPTY_ORDERED_HASH) |
1203 | 1208 |
|
1204 | 1209 | (defn ^number hash-unordered-coll
|
1205 | 1210 | "Returns the hash code, consistent with =, for an external unordered
|
|
1213 | 1218 | (recur (inc n) (bit-or (+ hash-code (hash (first coll))) 0) (next coll))
|
1214 | 1219 | (mix-collection-hash hash-code n))))
|
1215 | 1220 |
|
1216 |
| -(def ^:private empty-unordered-hash |
1217 |
| - (mix-collection-hash 0 0)) |
| 1221 | +(def ^{:private true :jsdoc ["@type {*}"]} |
| 1222 | + EMPTY_UNORDERED_HASH nil) |
| 1223 | + |
| 1224 | +(defn- empty-unordered-hash [] |
| 1225 | + (when (nil? EMPTY_UNORDERED_HASH) |
| 1226 | + (set! EMPTY_UNORDERED_HASH (mix-collection-hash 0 0))) |
| 1227 | + EMPTY_UNORDERED_HASH) |
1218 | 1228 |
|
1219 | 1229 | ;;;;;;;;;;;;;;;;;;; protocols on primitives ;;;;;;;;
|
1220 | 1230 | (declare hash-map list equiv-sequential)
|
@@ -2801,7 +2811,7 @@ reduces them without incurring seq initialization"
|
2801 | 2811 | false))
|
2802 | 2812 |
|
2803 | 2813 | IHash
|
2804 |
| - (-hash [coll] empty-ordered-hash) |
| 2814 | + (-hash [coll] (empty-ordered-hash)) |
2805 | 2815 |
|
2806 | 2816 | ISeqable
|
2807 | 2817 | (-seq [coll] nil)
|
@@ -4916,7 +4926,7 @@ reduces them without incurring seq initialization"
|
4916 | 4926 | (set! (.-EMPTY-NODE PersistentVector) (VectorNode. nil (make-array 32)))
|
4917 | 4927 |
|
4918 | 4928 | (set! (.-EMPTY PersistentVector)
|
4919 |
| - (PersistentVector. nil 0 5 (.-EMPTY-NODE PersistentVector) (array) empty-ordered-hash)) |
| 4929 | + (PersistentVector. nil 0 5 (.-EMPTY-NODE PersistentVector) (array) (empty-ordered-hash))) |
4920 | 4930 |
|
4921 | 4931 | (set! (.-fromArray PersistentVector)
|
4922 | 4932 | (fn [xs ^boolean no-clone]
|
@@ -5466,7 +5476,7 @@ reduces them without incurring seq initialization"
|
5466 | 5476 | ICounted
|
5467 | 5477 | (-count [coll] count))
|
5468 | 5478 |
|
5469 |
| -(set! (.-EMPTY PersistentQueue) (PersistentQueue. nil 0 nil [] empty-ordered-hash)) |
| 5479 | +(set! (.-EMPTY PersistentQueue) (PersistentQueue. nil 0 nil [] (empty-ordered-hash))) |
5470 | 5480 |
|
5471 | 5481 | (es6-iterable PersistentQueue)
|
5472 | 5482 |
|
@@ -5643,7 +5653,7 @@ reduces them without incurring seq initialization"
|
5643 | 5653 | (-as-transient [coll]
|
5644 | 5654 | (transient (into (hash-map) coll))))
|
5645 | 5655 |
|
5646 |
| -(set! (.-EMPTY ObjMap) (ObjMap. nil (array) (js-obj) 0 empty-unordered-hash)) |
| 5656 | +(set! (.-EMPTY ObjMap) (ObjMap. nil (array) (js-obj) 0 (empty-unordered-hash))) |
5647 | 5657 |
|
5648 | 5658 | (set! (.-HASHMAP_THRESHOLD ObjMap) 8)
|
5649 | 5659 |
|
@@ -5995,7 +6005,7 @@ reduces them without incurring seq initialization"
|
5995 | 6005 | (-as-transient [coll]
|
5996 | 6006 | (TransientArrayMap. (js-obj) (alength arr) (aclone arr))))
|
5997 | 6007 |
|
5998 |
| -(set! (.-EMPTY PersistentArrayMap) (PersistentArrayMap. nil 0 (array) empty-unordered-hash)) |
| 6008 | +(set! (.-EMPTY PersistentArrayMap) (PersistentArrayMap. nil 0 (array) (empty-unordered-hash))) |
5999 | 6009 |
|
6000 | 6010 | (set! (.-HASHMAP-THRESHOLD PersistentArrayMap) 8)
|
6001 | 6011 |
|
@@ -6931,7 +6941,7 @@ reduces them without incurring seq initialization"
|
6931 | 6941 | (-as-transient [coll]
|
6932 | 6942 | (TransientHashMap. (js-obj) root cnt has-nil? nil-val)))
|
6933 | 6943 |
|
6934 |
| -(set! (.-EMPTY PersistentHashMap) (PersistentHashMap. nil 0 nil false nil empty-unordered-hash)) |
| 6944 | +(set! (.-EMPTY PersistentHashMap) (PersistentHashMap. nil 0 nil false nil (empty-unordered-hash))) |
6935 | 6945 |
|
6936 | 6946 | (set! (.-fromArray PersistentHashMap)
|
6937 | 6947 | (fn [arr ^boolean no-clone]
|
@@ -7724,7 +7734,7 @@ reduces them without incurring seq initialization"
|
7724 | 7734 |
|
7725 | 7735 | (-comparator [coll] comp))
|
7726 | 7736 |
|
7727 |
| -(set! (.-EMPTY PersistentTreeMap) (PersistentTreeMap. compare nil 0 nil empty-unordered-hash)) |
| 7737 | +(set! (.-EMPTY PersistentTreeMap) (PersistentTreeMap. compare nil 0 nil (empty-unordered-hash))) |
7728 | 7738 |
|
7729 | 7739 | (es6-iterable PersistentTreeMap)
|
7730 | 7740 |
|
@@ -8045,7 +8055,7 @@ reduces them without incurring seq initialization"
|
8045 | 8055 | (-as-transient [coll] (TransientHashSet. (-as-transient hash-map))))
|
8046 | 8056 |
|
8047 | 8057 | (set! (.-EMPTY PersistentHashSet)
|
8048 |
| - (PersistentHashSet. nil (.-EMPTY PersistentArrayMap) empty-unordered-hash)) |
| 8058 | + (PersistentHashSet. nil (.-EMPTY PersistentArrayMap) (empty-unordered-hash))) |
8049 | 8059 |
|
8050 | 8060 | (set! (.-fromArray PersistentHashSet)
|
8051 | 8061 | (fn [items ^boolean no-clone]
|
@@ -8191,7 +8201,7 @@ reduces them without incurring seq initialization"
|
8191 | 8201 | (-lookup coll k not-found)))
|
8192 | 8202 |
|
8193 | 8203 | (set! (.-EMPTY PersistentTreeSet)
|
8194 |
| - (PersistentTreeSet. nil (.-EMPTY PersistentTreeMap) empty-unordered-hash)) |
| 8204 | + (PersistentTreeSet. nil (.-EMPTY PersistentTreeMap) (empty-unordered-hash))) |
8195 | 8205 |
|
8196 | 8206 | (es6-iterable PersistentTreeSet)
|
8197 | 8207 |
|
|
0 commit comments