Skip to content

Instantly share code, notes, and snippets.

@Jared314
Created July 20, 2013 02:46
Show Gist options
  • Save Jared314/6043638 to your computer and use it in GitHub Desktop.
Save Jared314/6043638 to your computer and use it in GitHub Desktop.
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