A cross-platform Clojure+Script asynchronous streams API - with error-propagation and transparent chunking. Modelled on the Manifold streams API and using Promesa CSP as its transport.
Implements a Manifold-like asynchronous streams API. The underlying backpressure-sensitive Promise + Stream model is the same as Manifold, and the API follows the Manifold streams API closely
(require '[promisespromises.stream :as s])
(def s (s/stream))
(s/put-all-and-close! s [0 1 2 3 4])
(def r (->> s (s/map inc) (s/reduce ::add +)))
;; => 15
It does a few things which vanilla Manifold doesn't:
map
, reduce
, transform
&c) propagate downstreampromisespromises.stream/cross
joins streams
sorted in a key - it has various styles of join - inner, outer,
left-n, merge, intersect, union -
and can be used for a sensible constant-memory approach to
in-memory joins with databases such as cassandraThe promisespromises.stream
API comes from work with cold streams, but
stream objects are just
Promesa CSP
channels, and promise objects are just Promesa Promises, so you can
always fall back to Promesa if you need something a bit different
Can you improve this documentation? These fine people already did:
mccraig mccraig of the clan mccraig & mccraigmccraig of the clan mccraigEdit at git repository
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close