Skip to content

Instantly share code, notes, and snippets.

@stuartsierra
Last active January 2, 2016 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartsierra/8364220 to your computer and use it in GitHub Desktop.
Save stuartsierra/8364220 to your computer and use it in GitHub Desktop.
concat in Clojure core.async (untested)
;; Totally untested
(defn concat [& chans]
(let [out (chan)]
(go-loop [[ch & more] chans]
(when ch
(let [val (<! ch)]
(if (nil? val)
(recur more)
(do (>! out val)
(recur chans))))))
out))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment