Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SerhiiKozachenko/8d52cd6aaabacd232d63ead4d6eaec50 to your computer and use it in GitHub Desktop.
Save SerhiiKozachenko/8d52cd6aaabacd232d63ead4d6eaec50 to your computer and use it in GitHub Desktop.
how to use transducer with clojure.core.async
;; I keep forgetting how to do this stuff for some reason, so here goes:
(let [c (async/chan 1 (map #(* % 2)))]
(async/go
(loop []
(when-let [e (async/<! c)]
(println "async/go, e:" e)
(recur))))
(async/>!! c 1)
(async/>!! c 2))
async/go, e: 2
async/go, e: 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment