Last active
September 24, 2018 10:36
-
-
Save cataska/91bfd5d3015b0712ccda305ce306495d to your computer and use it in GitHub Desktop.
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
(let [c (chan)] | |
(go (dotimes [x 3] | |
(>! c x) | |
(println "Put: " x))) | |
(go (dotimes [x 3] | |
(println "Take: " (<! c))))) | |
;; => Put: 0 | |
;; => Take: 0 | |
;; => Put: 1 | |
;; => Take: 1 | |
;; => Put: 2 | |
;; => Take: 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment