Last active
November 12, 2016 21:31
-
-
Save noisesmith/9da3803766ac2fb2283ec37c76096fa4 to your computer and use it in GitHub Desktop.
transducer on a channel
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
(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)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍 Thank you so much!