Core namespace of Tapestry
Core namespace of Tapestry
(alive? fiber)
Return whether the provided fiber
is alive
Return whether the provided `fiber` is alive
(asyncly f s)
(asyncly n f s)
Executes mapping function f
over the provided stream s
.
Returns a new stream in which items will be emitted in any order after f
finishes.
Runs each item in a loom fiber.
Optionally takes a number n
which will be the maximum parallelism.
Executes mapping function `f` over the provided stream `s`. Returns a new stream in which items will be emitted in any order after `f` finishes. Runs each item in a loom fiber. Optionally takes a number `n` which will be the maximum parallelism.
(fiber & body)
Execute body on a loom fiber, returning a deferred that will resolve when the fiber completes.
Execute body on a loom fiber, returning a deferred that will resolve when the fiber completes.
(fiber-loop bindings & body)
Execute a body inside a loop.
Execute a body inside a loop.
(interrupt! fiber)
Interrupt the provided fiber, causing a java.lang.InterruptedException
to be
thrown in the fiber
Return the provided fiber
for chaining
Interrupt the provided fiber, causing a `java.lang.InterruptedException` to be thrown in the `fiber` Return the provided `fiber`for chaining
(parallelly f s)
(parallelly n f s)
Maps f
over the stream or seq s
with up to n
items occuring in parallel.
If n
is not specified, will use unbounded parallelism (or the max parallism set via the
with-max-parallelism
macro).
Maps `f` over the stream or seq `s` with up to `n` items occuring in parallel. If `n` is not specified, will use unbounded parallelism (or the max parallism set via the `with-max-parallelism` macro).
(periodically period f)
(periodically period initial-delay f)
Behaves similarly to manifold.stream/periodically
but relies on a loom
fiber for time keeping. If no initial delay is specified runs immediately.
Also automatically coerces durations into millisecond values.
Behaves similarly to `manifold.stream/periodically` but relies on a loom fiber for time keeping. If no initial delay is specified runs immediately. Also automatically coerces durations into millisecond values.
(pfor seq-exprs body-expr)
Macro which behaves identically to clojure.core.for
but runs the body in parallell using
fibers.
Note that bindings in :let
and :when
will not be evaluated in parallel.
Will force evaluation of the sequence (ie. this is no longer lazy).
Macro which behaves identically to `clojure.core.for` but runs the body in parallell using fibers. Note that bindings in `:let` and `:when` will not be evaluated in parallel. Will force evaluation of the sequence (ie. this is no longer lazy).
(seq->stream expr)
Macro which runs an expression that returns a (presumably lazy) sequence and runs it in a fiber, returning a source stream of the results
Macro which runs an expression that returns a (presumably lazy) sequence and runs it in a fiber, returning a source stream of the results
(set-stream-error-handler! f)
Set a function to be called when an error occurs in a tapestry returned stream.
By default will println. Set to nil
to do nothing
Calls (f err msg)
.
Set a function to be called when an error occurs in a tapestry returned stream. By default will println. Set to `nil` to do nothing Calls `(f err msg)`.
(timeout! fiber timeout)
(timeout! fiber timeout default)
Set the provided timeout
on the provided fiber
, causing a
java.util.concurrent.TimeoutException
to be thrown on the deferred (or default
to be returrned)
and the fiber
to be interrupted.
Return the provied fiber
for chaining.
Accepts either a number in millis or a duration.
Set the provided `timeout` on the provided `fiber`, causing a `java.util.concurrent.TimeoutException` to be thrown on the deferred (or `default` to be returrned) and the `fiber` to be interrupted. Return the provied `fiber` for chaining. Accepts either a number in millis or a duration.
(with-max-parallelism n & body)
Executes the provided body with an executor that ensures that at most n
fibers
will run in parallel.
Executes the provided body with an executor that ensures that at most `n` fibers will run in parallel.
(with-timeout timeout & body)
Executes all newly spawned fibers with the provided timeout
.
Accepts either a number (used as millis
) or java.lang.Duration
for
timeout
.
Executes all newly spawned fibers with the provided `timeout`. Accepts either a number (used as `millis`) or `java.lang.Duration` for `timeout`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close