Permalink
Browse files

finish tea party through to an uberjar

  • Loading branch information...
jflinchbaugh committed Mar 2, 2018
1 parent bf7b020 commit fbc47483eb3f82733cd8fa4b7cb90e6bff1785bb
Showing with 24 additions and 4 deletions.
  1. +2 −0 project.clj
  2. +22 −4 src/async_tea_party/core.clj
View
@@ -7,4 +7,6 @@
[org.clojure/clojure "1.9.0"]
[org.clojure/core.async "0.4.474"]
]
:main async-tea-party.core
:aot [async-tea-party.core]
)
@@ -1,21 +1,39 @@
(ns async-tea-party.core
(:gen-class)
(:require [clojure.core.async :as async])
)
(def google-tea-service-chan (async/chan 10))
(def yahoo-tea-service-chan (async/chan 10))
(def result-chan (async/chan 10))
(defn random-add []
(reduce + (conj [] (repeat (rand-int 10000) 1))))
(defn request-google-tea-service []
(async/go
(random-add)
(async/>! google-tea-service-chan
"tea complimens of google")))
(async/>! google-tea-service-chan "tea compliments of google")))
(defn request-yahoo-tea-service []
(async/go
(random-add)
(async/>! yahoo-tea-service-chan
"tea complimens of yahoo")))
(async/>! yahoo-tea-service-chan "tea compliments of yahoo")))
(defn request-tea []
(request-google-tea-service)
(request-yahoo-tea-service)
(async/go (let
[
[v] (async/alts! [
google-tea-service-chan
yahoo-tea-service-chan
])
]
(async/>! result-chan v)))
)
(defn -main [& args]
(println "Requesting tea!")
(request-tea)
(println (async/<!! result-chan)))

0 comments on commit fbc4748

Please sign in to comment.