Skip to content

Instantly share code, notes, and snippets.

@amacdougall
Last active December 25, 2015 03:49
Show Gist options
  • Save amacdougall/6912217 to your computer and use it in GitHub Desktop.
Save amacdougall/6912217 to your computer and use it in GitHub Desktop.
Correct documentation of reactive/barrier.
;; 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