ClojureDocs

Nav

Namespaces

reducer

clojure.core.reducers

Available since 1.5
  • (reducer coll xf)
Given a reducible collection, and a transformation function xf,
returns a reducible collection, where any supplied reducing
fn will be transformed by xf. xf is a function of reducing fn to
reducing fn.
0 Examples
No examples for clojure.core.reducers/reducer.
See Also
No see-alsos for clojure.core.reducers/reducer
2 Notes
    By , created 7.0 years ago, updated 7.0 years ago

    ;;Beware of this bug

    ;;These two suppose to be the same:

    (transduce (comp (take 10) (partition-all 3)) conj (range)) ;; => [[0 1 2] [3 4 5] [6 7 8] [9]]

    (reduce conj (r/reducer (range) (comp (take 10) (partition-all 3)))) ;; => [[0 1 2] [3 4 5] [6 7 8]]

    ;;See https://dev.clojure.org/jira/browse/CLJ-2338

    By , created 7.0 years ago

    As far as I can see, clojure.core.reducers/reducer (since 1.5) is made obsolete by eduction (since 1.7), which can do the same and more.