clojure.core/reduce-kv¶
Reduces an associative collection. f should be a function of 3 arguments. Returns the result of applying f to init, the first key and the first value in coll, then applying f to that result and the 2nd key and value, etc. If coll contains no entries, returns init and f is not called. Note that reduce-kv is supported on vectors, where the keys will be the ordinals.
Examples¶
Note by KingMob¶
Currently broken for subvectors: CLJ-2065
Note by diegonayalazo¶
Seems to be fixed for subvectors as of release 1.11. https://clojure.atlassian.net/browse/CLJ-2065
See also¶
- clojure.core/reduce (22)
- clojure.core/reduced (3)
Content from the matching ClojureDocs page, with authors credited on each contribution.