-
-
Save rgm/dff54483f0705918191f48d461b33687 to your computer and use it in GitHub Desktop.
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 rgm.core | |
(:require [clojure.core.async :as a])) | |
(def c (a/chan)) | |
(def consumer | |
(a/go-loop | |
[a 0] | |
(let [b (a/<! c)] | |
(prn "in loop" a b) | |
(recur b)))) | |
(comment | |
(a/put! c 5) | |
(a/put! c 6) | |
) |
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
rgm@netherton 201907-async-prn % clj -A:rgm/nrepl | |
nREPL server started on port 52750 on host localhost - nrepl://localhost:52750 | |
nREPL 0.7.0-alpha1 | |
Clojure 1.10.1 | |
OpenJDK 64-Bit Server VM 12.0.1+12 | |
Interrupt: Control+C | |
Exit: Control+D or (exit) or (quit) | |
user=> (require '[clojure.core.async :as a]) | |
nil | |
user=> (require 'rgm.core :reload) | |
nil | |
user=> (a/put! rgm.core/c 10) | |
true | |
user=> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment