Skip to content

Instantly share code, notes, and snippets.

@lnostdal
Created May 18, 2018 07:50
Show Gist options
  • Save lnostdal/69c48174817e731e19675b933180fb06 to your computer and use it in GitHub Desktop.
Save lnostdal/69c48174817e731e19675b933180fb06 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