File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -4949,6 +4949,16 @@ reduces them without incurring seq initialization"
4949
4949
(-reduce [coll f start]
4950
4950
(ci-reduce coll f start))
4951
4951
4952
+ IKVReduce
4953
+ (-kv-reduce [coll f init]
4954
+ (loop [i start j 0 init init]
4955
+ (if (< i end)
4956
+ (let [init (f init j (-nth v i))]
4957
+ (if (reduced? init)
4958
+ @init
4959
+ (recur (inc i) (inc j) init)))
4960
+ init)))
4961
+
4952
4962
IFn
4953
4963
(-invoke [coll k]
4954
4964
(-nth coll k))
Original file line number Diff line number Diff line change 459
459
; ; no layered subvecs
460
460
(is (identical? v1 (.-v (subvec s 1 4 ))))
461
461
(let [m {:x 1 }]
462
- (is (= m (meta (with-meta s m))))))
462
+ (is (= m (meta (with-meta s m)))))
463
+ ; ; CLJS-997
464
+ (is (= (reduce-kv + 123 (vec (range 10 50 )))
465
+ (reduce-kv + 123 (subvec (vec (range 100 )) 10 50 )))))
463
466
; ; CLJS-513
464
467
(let [sentinel (js-obj )
465
468
s (subvec [0 1 2 3 ] 1 2 )]
You can’t perform that action at this time.
0 commit comments