Skip to content

Instantly share code, notes, and snippets.

@timvisher
Created December 8, 2014 18:38
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 timvisher/feb385d634143e08114a to your computer and use it in GitHub Desktop.
Save timvisher/feb385d634143e08114a to your computer and use it in GitHub Desktop.
(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