Last active
December 25, 2015 03:49
-
-
Save amacdougall/6912217 to your computer and use it in GitHub Desktop.
Correct documentation of reactive/barrier.
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
;; Given a seq of channels, waits until each channel has received a value, and | |
;; then returns a vec of each value. | |
(defn barrier [cs] | |
(go (loop [cs (seq cs) result []] | |
(if cs | |
(recur (next cs) (conj result (<! (first cs)))) | |
result)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment