Skip to content

Instantly share code, notes, and snippets.

@rgm

rgm/core.clj Secret

Created August 1, 2019 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgm/dff54483f0705918191f48d461b33687 to your computer and use it in GitHub Desktop.
Save rgm/dff54483f0705918191f48d461b33687 to your computer and use it in GitHub Desktop.
(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)
)
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