Last active
December 23, 2015 11:09
-
-
Save MarcoPolo/6626584 to your computer and use it in GitHub Desktop.
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
(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