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"
49494949 (-reduce [coll f start]
49504950 (ci-reduce coll f start))
49514951
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+
49524962 IFn
49534963 (-invoke [coll k]
49544964 (-nth coll k))
Original file line number Diff line number Diff line change 459459 ; ; no layered subvecs
460460 (is (identical? v1 (.-v (subvec s 1 4 ))))
461461 (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 )))))
463466 ; ; CLJS-513
464467 (let [sentinel (js-obj )
465468 s (subvec [0 1 2 3 ] 1 2 )]
You can’t perform that action at this time.
0 commit comments