Skip to content

Instantly share code, notes, and snippets.

Created Jul 21, 2013
What would you like to do?
Clojure core.async example 2
(ns async2
(:require [clojure.core.async :as async]
[clojure.core.async.lab :as lab]))
(defn make-fb-group [& members]
(apply lab/broadcast members))
(defn alice [c]
(async/>!! c "Dave Davenson's House @ 10pm"))
(defn bob []
(let [c (async/chan 1)]
(async/go (println "Bob received: " (async/<! c)))
(defn carol []
(let [c (async/chan 1)]
(async/go (println "Carol received: " (async/<! c)))
(let [fb-group (make-fb-group (bob) (carol))]
; Alice sends the message to the group
(alice fb-group))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment