File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -5743,9 +5743,10 @@ reduces them without incurring seq initialization"
5743
5743
(-lookup [coll v]
5744
5744
(-lookup coll v nil ))
5745
5745
(-lookup [coll v not-found]
5746
- (if (-contains-key? tree-map v)
5747
- v
5748
- not-found))
5746
+ (let [n (.entry-at tree-map v)]
5747
+ (if-not (nil? n)
5748
+ (.-key n)
5749
+ not-found)))
5749
5750
5750
5751
ISet
5751
5752
(-disjoin [coll v]
Original file line number Diff line number Diff line change 1260
1260
; ; PersistentTreeSet
1261
1261
(let [s1 (sorted-set )
1262
1262
c2 (comp - compare)
1263
- s2 (sorted-set-by c2)]
1263
+ s2 (sorted-set-by c2)
1264
+ c3 #(compare (quot %1 2 ) (quot %2 2 ))
1265
+ s3 (sorted-set-by c3)]
1264
1266
(assert (identical? cljs.core.PersistentTreeSet (type s1)))
1265
1267
(assert (identical? cljs.core.PersistentTreeSet (type s2)))
1266
1268
(assert (identical? compare (-comparator s1)))
1267
1269
(assert (identical? c2 (-comparator s2)))
1268
1270
(assert (zero? (count s1)))
1269
1271
(assert (zero? (count s2)))
1270
1272
(let [s1 (conj s1 1 2 3 )
1271
- s2 (conj s2 1 2 3 )]
1273
+ s2 (conj s2 1 2 3 )
1274
+ s3 (conj s3 1 2 3 )]
1272
1275
(assert (= (hash s1) (hash s2)))
1273
1276
(assert (= (hash s1) (hash #{1 2 3 })))
1274
1277
(assert (= (seq s1) (list 1 2 3 )))
1277
1280
(assert (= (rseq s2) (list 1 2 3 )))
1278
1281
(assert (= (count s1) 3 ))
1279
1282
(assert (= (count s2) 3 ))
1283
+ (assert (= (count s3) 2 ))
1284
+ (assert (= (get s3 0 ) 1 ))
1280
1285
(let [s1 (disj s1 2 )
1281
1286
s2 (disj s2 2 )]
1282
1287
(assert (= (seq s1) (list 1 3 )))
You can’t perform that action at this time.
0 commit comments