-
-
Save SerhiiKozachenko/8d52cd6aaabacd232d63ead4d6eaec50 to your computer and use it in GitHub Desktop.
how to use transducer with clojure.core.async
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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