(batch in out size timeout)
(batch in out size timeout close?)
Takes messages from in and batch them until reaching size or timeout ms, and puts them to out.
Takes messages from in and batch them until reaching size or timeout ms, and puts them to out.
(batch* in out size timeout rf close?)
(batch* in out size timeout rf init close?)
Takes messages from in and batch them until reaching size or timeout ms, and puts them to out. Batches with reducing function rf into initial value init. If init is not supplied rf is called with zero args.
Takes messages from in and batch them until reaching size or timeout ms, and puts them to out. Batches with reducing function rf into initial value init. If init is not supplied rf is called with zero args.
(consume ch v & body)
Takes values repeatedly from ch as v and runs body.
The opposite of produce.
Stops consuming values when the channel is closed.
Takes values repeatedly from ch as v and runs body. The opposite of produce. Stops consuming values when the channel is closed.
(consume* ch f)
Takes values repeatedly from channels and applies f to them.
The opposite of produce.
Stops consuming values when the channel is closed.
Takes values repeatedly from channels and applies f to them. The opposite of produce. Stops consuming values when the channel is closed.
(consume-blocking ch v & body)
Takes values repeatedly from ch as v and runs body.
The opposite of produce.
Stops consuming values when the channel is closed.
Like consume
but blocking.
Takes values repeatedly from ch as v and runs body. The opposite of produce. Stops consuming values when the channel is closed. Like `consume` but blocking.
(consume-blocking* ch f)
Takes values repeatedly from channels and applies f to them.
The opposite of produce.
Stops consuming values when the channel is closed.
Like consume*
but blocking.
Takes values repeatedly from channels and applies f to them. The opposite of produce. Stops consuming values when the channel is closed. Like `consume*` but blocking.
(consume-blocking?* ch f)
Takes values repeatedly from channels and applies f to them. Recurs only when f returns a non false-y value.
The opposite of produce.
Stops consuming values when the channel is closed.
Like consume?
but blocking.
Takes values repeatedly from channels and applies f to them. Recurs only when f returns a non false-y value. The opposite of produce. Stops consuming values when the channel is closed. Like `consume?` but blocking.
(consume? ch v & body)
Takes values repeatedly from ch as v and runs body.
The opposite of produce.
Stops consuming values when the channel is closed or body evaluates to a false-y value.
Takes values repeatedly from ch as v and runs body. The opposite of produce. Stops consuming values when the channel is closed or body evaluates to a false-y value.
(consume?* ch f)
Takes values repeatedly from channels and applies f to them. Recurs only when f returns a non false-y value.
The opposite of produce.
Stops consuming values when the channel is closed.
Takes values repeatedly from channels and applies f to them. Recurs only when f returns a non false-y value. The opposite of produce. Stops consuming values when the channel is closed.
(control* f cf ctl)
Wraps f with control function cf such that f will be invoked when: cf returns a truthy value for a value taken from ctl channel or there is no signal on ctl channel to take immidiately
Wraps f with control function cf such that f will be invoked when: cf returns a truthy value for a value taken from ctl channel or there is no signal on ctl channel to take immidiately
(fan! f xf from to)
Partition values from from
by f
and apply xf
to each partition.
Useful for stateful transducer operating on streaming partitioned data
when the partitions aren't know a priori.
Warnings and caveats: creates a new channel and go block per new partition. Very bad for unbounded inputs.
Partition values from `from` by `f` and apply `xf` to each partition. Useful for stateful transducer operating on streaming partitioned data when the partitions aren't know a priori. Warnings and caveats: creates a new channel and go block per new partition. Very bad for unbounded inputs.
(interrupt-control f ctl)
(interrupt-control f cf ctl)
(interrupt-control f cf ctl & es-ehs)
Like control
but only checks ctl channel if f throws.
takes an optional seq of exceptions and exception handlers to
handle different exceptions which can be thrown by f.
Like `control` but only checks ctl channel if f throws. takes an optional seq of exceptions and exception handlers to handle different exceptions which can be thrown by f.
(ooo-pipeline n to xf from)
(ooo-pipeline n to xf from close?)
(ooo-pipeline n to xf from close? ex-handler)
Takes elements from the from channel and supplies them to the to channel, subject to the transducer xf, with parallelism n. Because it is parallel, the transducer will be applied independently to each element, not across elements, and may produce zero or more outputs per input. Outputs will be returned OUT OF ORDER. By default, the to channel will be closed when the from channel closes, but can be determined by the close? parameter. Will stop consuming the from channel if the to channel closes. Note this should be used for computational parallelism. If you have multiple blocking operations to put in flight, use ooo-pipeline-blocking instead, If you have multiple asynchronous operations to put in flight, use ooo-pipeline-async instead.
Takes elements from the from channel and supplies them to the to channel, subject to the transducer xf, with parallelism n. Because it is parallel, the transducer will be applied independently to each element, not across elements, and may produce zero or more outputs per input. Outputs will be returned OUT OF ORDER. By default, the to channel will be closed when the from channel closes, but can be determined by the close? parameter. Will stop consuming the from channel if the to channel closes. Note this should be used for computational parallelism. If you have multiple blocking operations to put in flight, use ooo-pipeline-blocking instead, If you have multiple asynchronous operations to put in flight, use ooo-pipeline-async instead.
(ooo-pipeline-async n to af from)
(ooo-pipeline-async n to af from close?)
Takes elements from the from channel and supplies them to the to channel, subject to the async function af, with parallelism n. af must be a function of two arguments, the first an input value and the second a channel on which to place the result(s). af must close! the channel before returning. The presumption is that af will return immediately, having launched some asynchronous operation (i.e. in another thread) whose completion/callback will manipulate the result channel. Outputs will be returned OUT OF ORDER. By default, the to channel will be closed when the from channel closes, but can be determined by the close? parameter. Will stop consuming the from channel if the to channel closes. See also ooo-pipeline, ooo-pipeline-blocking.
Takes elements from the from channel and supplies them to the to channel, subject to the async function af, with parallelism n. af must be a function of two arguments, the first an input value and the second a channel on which to place the result(s). af must close! the channel before returning. The presumption is that af will return immediately, having launched some asynchronous operation (i.e. in another thread) whose completion/callback will manipulate the result channel. Outputs will be returned OUT OF ORDER. By default, the to channel will be closed when the from channel closes, but can be determined by the close? parameter. Will stop consuming the from channel if the to channel closes. See also ooo-pipeline, ooo-pipeline-blocking.
(ooo-pipeline-blocking n to xf from)
(ooo-pipeline-blocking n to xf from close?)
(ooo-pipeline-blocking n to xf from close? ex-handler)
Like ooo-pipeline, for blocking operations.
Like ooo-pipeline, for blocking operations.
(produce ch & body)
Execute body repeatedly in a go-loop and put its results into output ch.
Execute body repeatedly in a go-loop and put its results into output ch.
(produce* ch f)
(produce* ch f close?)
Puts the contents repeatedly calling f into the supplied channel.
By default the channel will be closed if f returns nil.
Based on clojure.core.async/onto-chan. Equivalent to (onto-chan ch (repeatedly f)) but cuts out the seq.
Puts the contents repeatedly calling f into the supplied channel. By default the channel will be closed if f returns nil. Based on clojure.core.async/onto-chan. Equivalent to (onto-chan ch (repeatedly f)) but cuts out the seq.
(produce-blocking ch & body)
Execute body repeatedly in a loop and put its results into output ch.
Like produce*
but blocking.
Should be called inside a thread or a future.
Execute body repeatedly in a loop and put its results into output ch. Like `produce*` but blocking. Should be called inside a thread or a future.
(produce-blocking* ch f)
(produce-blocking* ch f close?)
Puts the contents repeatedly calling f into the supplied channel.
By default the channel will be closed if f returns nil.
Like produce*
but blocking.
Should be called inside a thread or a future.
Puts the contents repeatedly calling f into the supplied channel. By default the channel will be closed if f returns nil. Like `produce*` but blocking. Should be called inside a thread or a future.
(reductions* rf init in out)
(reductions* rf init in out close?)
Like core/reductions, but takes elements from in channel and produces them to out channel.
Like core/reductions, but takes elements from in channel and produces them to out channel.
(split* f ch m)
Takes a channel, function f :: v -> k and a map of keys to channels k -> ch, routing the values v from the input channel to the channel such that (f v) -> ch.
(get m (f v)) must be non-nil for every v!
Takes a channel, function f :: v -> k and a map of keys to channels k -> ch, routing the values v from the input channel to the channel such that (f v) -> ch. (get m (f v)) must be non-nil for every v!
(split-maybe f ch m)
Takes a channel, function f :: v -> k and a map of keys to channels k -> ch, routing the values v from the input channel to the channel such that (f v) -> ch.
If (f v) is not in m, the value is dropped
Takes a channel, function f :: v -> k and a map of keys to channels k -> ch, routing the values v from the input channel to the channel such that (f v) -> ch. If (f v) is not in m, the value is dropped
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close