Created
July 20, 2013 02:46
-
-
Save Jared314/6043638 to your computer and use it in GitHub Desktop.
Clojure core.async example 1
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 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