Skip to content

clojure.core.async/reduce

View this page on ClojureDocs

Type: function Added: Clojure unknown Examples: 3 Runnable: 0
([f init ch])

f should be a function of 2 arguments. Returns a channel containing the single result of applying f to init and the first item from the channel, then applying f to that result and the 2nd item, etc. If the channel closes without yielding items, returns init and f is not called. ch must close before reduce produces a result.

Examples

by jhn on . May have evaluation errors.
by jhn on . May have evaluation errors.
by agodde on . May have evaluation errors.

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.