(<!* chs)
Takes one result from each channel and returns them as a collection. The results maintain the order of channels.
Takes one result from each channel and returns them as a collection. The results maintain the order of channels.
(<<! ch)
Takes multiple results from a channel and returns them as a vector. The input channel must be closed.
Takes multiple results from a channel and returns them as a vector. The input channel must be closed.
(<<? ch)
Takes multiple results from a channel and returns them as a vector. Throws if any result is an exception.
Takes multiple results from a channel and returns them as a vector. Throws if any result is an exception.
(<? ch)
Same as core.async <! but throws an exception if the channel returns a throwable object. Also will not crash if channel is nil.
Same as core.async <! but throws an exception if the channel returns a throwable object. Also will not crash if channel is nil.
(<?* chs)
Takes one result from each channel and returns them as a collection. The results maintain the order of channels. Throws if any of the channels returns an exception.
Takes one result from each channel and returns them as a collection. The results maintain the order of channels. Throws if any of the channels returns an exception.
(<?? ch)
Same as core.async <!! but throws an exception if the channel returns a throwable object. Also will not crash if channel is nil.
Same as core.async <!! but throws an exception if the channel returns a throwable object. Also will not crash if channel is nil.
(alts? ports)
Same as core.async alts! but throws an exception if the channel returns a throwable object.
Same as core.async alts! but throws an exception if the channel returns a throwable object.
(concat>> & cs)
Concatenates two or more channels. First takes all values from first channel and supplies to output channel, then takes all values from second channel and so on. Similiar to core.async/merge but maintains the order of values.
Concatenates two or more channels. First takes all values from first channel and supplies to output channel, then takes all values from second channel and so on. Similiar to core.async/merge but maintains the order of values.
(count> ch)
Counts items in a channel. Returns a channel with the item count.
Counts items in a channel. Returns a channel with the item count.
(debounce>> ch interval)
Debounces channel. Forwards first item from input channel to output immediately. After that one item every interval ms (if any). If there are more items in between, they are dropped.
Debounces channel. Forwards first item from input channel to output immediately. After that one item every interval ms (if any). If there are more items in between, they are dropped.
(engulf & cs)
Similiar to dorun. Simply takes messages from channels but does nothing with them. Returns channel that will close when all messages have been consumed.
Similiar to dorun. Simply takes messages from channels but does nothing with them. Returns channel that will close when all messages have been consumed.
(go-retry {:keys [exception retries delay error-fn should-retry-fn on-error]
:or {error-fn nil retries 5 delay 1 on-error nil}}
&
body)
Attempts to evaluate a go block and retries it if should-retry-fn
which is invoked with block's evaluation result evaluates to false.
should-retry-fn
is optional and by default it will simply check if
result is of type Throwable (clj) / js/Error (cljs). If the evaluation
still fails after given retries, the last failed result will be
returned in channel.
Parameters:
Attempts to evaluate a go block and retries it if `should-retry-fn` which is invoked with block's evaluation result evaluates to false. `should-retry-fn` is optional and by default it will simply check if result is of type Throwable (clj) / js/Error (cljs). If the evaluation still fails after given retries, the last failed result will be returned in channel. Parameters: * retries - how many times to retry (default 5 times) * delay - how long to wait in seconds between retries (default 1s) * should-retry-fn - function that is invoked with result of block's evaluation and should indicate whether to retry (if it returns true) or not (returns false) * error-fn - DEPRECATED, use should-retry-fn instead
(go-try & body)
Asynchronously executes the body in a go block. Returns a channel which will receive the result of the body when completed or an exception if one is thrown.
Asynchronously executes the body in a go block. Returns a channel which will receive the result of the body when completed or an exception if one is thrown.
(pmap>> f> parallelism in-ch)
(pmap>> f> parallelism out-ch in-ch)
Takes objects from in-ch, asynchrously applies function f> (function should return a channel), takes the result from the returned channel and if it's truthy, puts it in the out-ch. Returns the closed out-ch. Closes the returned channel when the input channel has been completely consumed and all objects have been processed. If out-ch is not provided, an unbuffered one will be used.
Takes objects from in-ch, asynchrously applies function f> (function should return a channel), takes the result from the returned channel and if it's truthy, puts it in the out-ch. Returns the closed out-ch. Closes the returned channel when the input channel has been completely consumed and all objects have been processed. If out-ch is not provided, an unbuffered one will be used.
(reduce> f> acc ch)
Performs a reduce on objects from ch with the function f> (which should return a channel). Returns a channel with the resulting value.
Performs a reduce on objects from ch with the function f> (which should return a channel). Returns a channel with the resulting value.
(thread-try & body)
Asynchronously executes the body in a thread. Returns a channel which will receive the result of the body when completed or an exception if one is thrown.
Asynchronously executes the body in a thread. Returns a channel which will receive the result of the body when completed or an exception if one is thrown.
(throw-if-throwable x)
Helper method that checks if x is Throwable and if yes, wraps it in a new exception, passing though ex-data if any, and throws it. The wrapping is done to maintain a full stack trace when jumping between multiple contexts.
Helper method that checks if x is Throwable and if yes, wraps it in a new exception, passing though ex-data if any, and throws it. The wrapping is done to maintain a full stack trace when jumping between multiple contexts.
Helper method that checks if x is JavaScript Error. If it is, throws it, otherwise returns x.
Helper method that checks if x is JavaScript Error. If it is, throws it, otherwise returns x.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close