Permalink
Browse files

channels for tea party

  • Loading branch information...
jflinchbaugh committed Mar 1, 2018
1 parent b543ea3 commit bf7b020f062bf4ce92a01eb036344793729aaf80
Showing with 15 additions and 3 deletions.
  1. +15 −3 src/async_tea_party/core.clj
@@ -2,8 +2,20 @@
(:require [clojure.core.async :as async])
)
(def tea-channel (async/chan 10))
(def google-tea-service-chan (async/chan 10))
(def yahoo-tea-service-chan (async/chan 10))
(async/>!! tea-channel :cup-of-tea)
(defn random-add []
(reduce + (conj [] (repeat (rand-int 10000) 1))))
(async/<!! tea-channel)
(defn request-google-tea-service []
(async/go
(random-add)
(async/>! google-tea-service-chan
"tea complimens of google")))
(defn request-yahoo-tea-service []
(async/go
(random-add)
(async/>! yahoo-tea-service-chan
"tea complimens of yahoo")))

0 comments on commit bf7b020

Please sign in to comment.