Skip to content

Instantly share code, notes, and snippets.

@schmee
Created August 18, 2014 19:03
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 schmee/3f438ebf69998545e2ec to your computer and use it in GitHub Desktop.
Save schmee/3f438ebf69998545e2ec to your computer and use it in GitHub Desktop.
; This works
(defn client [id error]
(let [c (chan)]
(go
(while true
(let [[v ch] (alts! [c error])]
(println (str id ": channel!" v)))))
c))
; This doesn't
(defn client [id error]
(let [c (chan)]
(go
(while true
(alt!
c ([v] println (str id ": channel!" v))
error ([v] println (str id ": error!" v)))))
c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment