Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(ns some.core
(:refer-clojure :exclude [transduce])
(:require [clojure.core.async :as async]))
;; -----------------------------------------------------------------------------
(defn transduce
"An async transduce variant. Does not provide any special handling for steps
in xform that might return channels, i.e. steps should return/pass non-channel
([xform f chan] (transduce xform f (f) chan))
([xform f init chan]
(go (let [f (xform f)
ret (async/reduce f init chan)]
(f (<! ret))))))
;; (transduce xform (completing conj) (async/merge [ch1 ch2 ch3 ...]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.