Created
December 8, 2014 18:38
-
-
Save timvisher/feb385d634143e08114a 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
(ns async-playground | |
(:require-macros [cljs.core.async.macros :refer [go]]) | |
(:require [cljs.core.async :refer [>! <! chan]])) | |
(def ichan (chan)) | |
(go (while true | |
(let [o (<! ichan)] | |
(println o)))) | |
;;; Appears to have a buffering effect, where I need to execute it | |
;;; again to see the last value I put in echoed. | |
(go (>! ichan "ohai")) | |
(go (>! ichan "charnock")) | |
(def ichan2 (chan)) | |
(def ochan (chan)) | |
(go (while true | |
(let [o (<! ichan2)] | |
(>! ochan o)))) | |
(go (>! ichan2 "ohai")) | |
(go (println (<! ochan))) | |
;;; This appears to be subject to the same sort of buffering issues. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment