Created
August 28, 2013 04:28
-
-
Save yayitswei/6362139 to your computer and use it in GitHub Desktop.
core.async trouble
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
(defn fetch-user [username] | |
(go | |
(let [ch (chan)] | |
(letrpc [user (get-user-info username)] ;; shoreleave remote's letrpc macro | |
(>! ch user) | |
(close! ch)) | |
ch))) | |
(defn display-user-info [username] | |
(go (let [u (<! (fetch-user username))] | |
(log u) ;; prints out a channel instead of a user map | |
))) | |
(display-user-info "wei") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment