mirror of
https://github.com/janet-lang/janet
synced 2024-11-24 17:27:18 +00:00
16 lines
311 B
Clojure
16 lines
311 B
Clojure
(def c (ev/chan 4))
|
|
|
|
(defn writer []
|
|
(for i 0 10
|
|
(ev/sleep 0.1)
|
|
(print "writer giving item " i "...")
|
|
(ev/give c (string "item " i))))
|
|
|
|
(defn reader [name]
|
|
(forever
|
|
(print "reader " name " got " (ev/take c))))
|
|
|
|
(ev/call writer)
|
|
(each letter [:a :b :c :d :e :f :g]
|
|
(ev/call reader letter))
|