(catch-error-or-exception-or-nil f)
For a fn f
that takes zero arguments, when nil is returned or an Error or
Exception is caught, returns anomaly. 'nil' returns don't work well with
clojure.core.async
.
For a fn `f` that takes zero arguments, when nil is returned or an Error or Exception is caught, returns anomaly. 'nil' returns don't work well with `clojure.core.async`.
(thread threading-type fs)
Call each of the functions fs
on a separate thread. Each of the fs
are
wrapped such that hangs are prevented by catching nil returns and Exceptions
and Errors, and returning an anomaly.
Options for threading-type
:
:and
-- Returns nil if any anomalies are returned, otherwise returns a
vector with all the results in order corresponding to their fs
.
-- Short-circuits (and cancels the calls to remaining fs
) on first
returned anomaly.
:first!!
-- Returns nil if all are anomalies, otherwise returns value of
first result.
-- Short-circuits (and cancels the calls to remaining fs
) on
first returned value.
-- This induces race conditions between threads and can lead to
inconsistent results.
:any-ordered
-- Returns a tuple containing the [value index] as soon as any
function returns with the previous fs
all having
returned an anomaly. Otherwise, returns nil.
:all
-- Returns a vector with all the results in order corresponding to
their fs
.
:or
-- Returns false if all are anomalies, otherwise returns true.
-- Short-circuits (and cancels the calls to remaining fs
) on first
value returned.
Call each of the functions `fs` on a separate thread. Each of the `fs` are wrapped such that hangs are prevented by catching nil returns and Exceptions and Errors, and returning an anomaly. Options for `threading-type`: `:and` -- Returns nil if any anomalies are returned, otherwise returns a vector with all the results in order corresponding to their `fs`. -- Short-circuits (and cancels the calls to remaining `fs`) on first returned anomaly. `:first!!` -- Returns nil if all are anomalies, otherwise returns value of first result. -- Short-circuits (and cancels the calls to remaining `fs`) on first returned value. -- This induces race conditions between threads and can lead to inconsistent results. `:any-ordered` -- Returns a tuple containing the [value index] as soon as any function returns with the previous `fs` all having returned an anomaly. Otherwise, returns nil. `:all` -- Returns a vector with all the results in order corresponding to their `fs`. `:or` -- Returns false if all are anomalies, otherwise returns true. -- Short-circuits (and cancels the calls to remaining `fs`) on first value returned.
(thread-max fs)
Calls each of the functions fs
on a separate thread, and returns the
maximum value. Each of the fs
are wrapped such that hangs are prevented by
catching nil returns and Exceptions and Errors, and anomalies are ignored.
Calls each of the functions `fs` on a separate thread, and returns the maximum value. Each of the `fs` are wrapped such that hangs are prevented by catching nil returns and Exceptions and Errors, and anomalies are ignored.
(thread-min fs)
Calls each of the functions fs
on a separate thread, and returns the
minimum value. Each of the fs
are wrapped such that hangs are prevented by
catching nil returns and Exceptions and Errors, and anomalies are ignored.
Calls each of the functions `fs` on a separate thread, and returns the minimum value. Each of the `fs` are wrapped such that hangs are prevented by catching nil returns and Exceptions and Errors, and anomalies are ignored.
(thread-select selector-fn fs)
Call each of the functions fs
on a separate thread, and select thread
result using selector-fn
. Each of the fs
are wrapped such that hangs are
prevented by catching nil returns and Exceptions and Errors, and anomalies
are ignored.
Call each of the functions `fs` on a separate thread, and select thread result using `selector-fn`. Each of the `fs` are wrapped such that hangs are prevented by catching nil returns and Exceptions and Errors, and anomalies are ignored.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close