Exploring Core.async in Clojure: Demos, Features, and Examples
Table of Contents
Topics
Topics to consider
- core.async
- spec
- transducers
- onyx
- reagent
- datascript
Background
Use of queue-like channels. CSP as foundation.
Demos
Show the demos associated that are generally shown with core.async.
Features
put and take
- Alts
- Combining
- buffer size will block when full until another take
| op | go | thread | (external) |
|---|---|---|---|
| put | (>! ch val) | (>!! ch val) | (put! ch val) |
| take | (<! ch) | (<!! ch) | (take ch) |
alts
(let [c1 (chan)
c2 (chan)]
(thread (while true
(let [[v ch] (alts!! [c1 c2])]
(println "Read" v "from" ch)))))
merge and split
(split p in-chan t-chan f-chan)
mult and tap
Examples
Diffie-Hellman Handshake
Cognitech core.async Webinar
Rate Throttle
Specify the rate of requests.
- unthrottled
- setTimeout
- _.throttle
- bucket