Last active
January 8, 2016 14:21
-
-
Save noisesmith/d2b488f3f99dfb6ec524 to your computer and use it in GitHub Desktop.
experiment with closing and putting in 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
(require '[clojure.core.async :refer [>! <! chan go timeout]]) | |
(defn test-closers | |
[buffer delay] | |
(let [ch (chan buffer)] | |
(go (>! ch 1) | |
(println 1) | |
(>! ch 2) | |
(println :done)) | |
(go (<! ch) | |
(when delay | |
(<! (timeout delay)) | |
(println "waited" delay)) | |
(close! ch))) | |
nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment