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"
2624
2624
and f is not called. Note that reduce-kv is supported on vectors,
2625
2625
where the keys will be the ordinals."
2626
2626
([f init coll]
2627
- (if-not ( nil? coll)
2627
+ (if ( satisfies? IKVReduce coll)
2628
2628
(-kv-reduce coll f init)
2629
- init)))
2629
+ (reduce (fn [ret me]
2630
+ (f ret (-key me) (-val me)))
2631
+ init coll))))
2630
2632
2631
2633
(defn identity
2632
2634
" Returns its argument."
Original file line number Diff line number Diff line change 1975
1975
{1 1 3 3 } (update-keys (array-map 0 1 2 3 ) inc)
1976
1976
{1 1 3 3 } (update-keys (sorted-map 2 3 0 1 ) inc))))
1977
1977
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
+
1978
1984
(defn cljs-3386-test-fn
1979
1985
([x] x) ([_ _ & zs] zs))
1980
1986
You can’t perform that action at this time.
0 commit comments