Skip to content

Instantly share code, notes, and snippets.

@cataska
Last active September 24, 2018 10:36
Show Gist options
  • Save cataska/91bfd5d3015b0712ccda305ce306495d to your computer and use it in GitHub Desktop.
Save cataska/91bfd5d3015b0712ccda305ce306495d to your computer and use it in GitHub Desktop.
(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