Skip to content

Instantly share code, notes, and snippets.

@MarcoPolo
Last active December 23, 2015 11:09
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 MarcoPolo/6626584 to your computer and use it in GitHub Desktop.
Save MarcoPolo/6626584 to your computer and use it in GitHub Desktop.
(def k (cljs.core.async/chan 3))
;; This doesn't work as expected
(go
(.log js/console "loading: 42")
(>! k 42))
;; This parks when trying to take from the channel
(go
(.log js/console "Trying to read channel")
(.log js/console (<! k))
(.log js/console "Channel read"))
;;-----------
;; However this will work
(go
(.log js/console "Trying to read channel")
(.log js/console (<! k))
(.log js/console "Channel read"))
(go
(.log js/console "loading: 42")
(>! k 42))
;;I thought it would work both ways? what gives?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment