Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Clojure core.async example 1
(ns async1
(:require [clojure.core.async :as async]))
(defn alice [c]
(async/>!! c "Carol Carolson's House @ 10pm"))
(defn bob [c]
(async/go (println "Bob received: " (async/<! c))))
(let [phonenumber-555-555-9292 (async/chan)]
; Bob waits for Alice's text
(bob phonenumber-555-555-9292)
; Alice sends Bob the text
(alice phonenumber-555-555-9292))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment