Skip to content

Instantly share code, notes, and snippets.

@noisesmith
Last active November 12, 2016 21:31
Show Gist options
  • Save noisesmith/9da3803766ac2fb2283ec37c76096fa4 to your computer and use it in GitHub Desktop.
Save noisesmith/9da3803766ac2fb2283ec37c76096fa4 to your computer and use it in GitHub Desktop.
transducer on a channel
(ns foo.bar.async-transducing
(:require [clojure.core.async :as >]))
(defn run-it
[]
(let [c (>/chan 20 (partition-all 10))]
(>/go-loop []
(when-let [things (>/<! c)]
(println "things:" (pr-str things))
(recur)))
(>/go (dotimes [n 77]
(>/>! c n))
(>/close! c))))
@hansenpansen
Copy link

👍 Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment