File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -2624,9 +2624,11 @@ reduces them without incurring seq initialization"
26242624 and f is not called. Note that reduce-kv is supported on vectors,
26252625 where the keys will be the ordinals."
26262626 ([f init coll]
2627- (if-not ( nil? coll)
2627+ (if ( satisfies? IKVReduce coll)
26282628 (-kv-reduce coll f init)
2629- init)))
2629+ (reduce (fn [ret me]
2630+ (f ret (-key me) (-val me)))
2631+ init coll))))
26302632
26312633(defn identity
26322634 " Returns its argument."
Original file line number Diff line number Diff line change 19751975 {1 1 3 3 } (update-keys (array-map 0 1 2 3 ) inc)
19761976 {1 1 3 3 } (update-keys (sorted-map 2 3 0 1 ) inc))))
19771977
1978+ (deftest test-cljs-3363
1979+ (is (= {}
1980+ (reduce-kv #(assoc %1 %3 %2 ) {} nil )))
1981+ (is (= {1 :a 2 :b }
1982+ (reduce-kv #(assoc %1 %3 %2 ) {} (seq {:a 1 :b 2 })))))
1983+
19781984(defn cljs-3386-test-fn
19791985 ([x] x) ([_ _ & zs] zs))
19801986
You can’t perform that action at this time.
0 commit comments