Created
May 18, 2018 07:50
-
-
Save lnostdal/69c48174817e731e19675b933180fb06 to your computer and use it in GitHub Desktop.
how to use transducer with clojure.core.async
This file contains 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