(!<! v)
An improved macro version of <!, which also rethrows exceptions returned over the channel. Must be called INSIDE a (go ...) or (async ...) block.
An improved macro version of <!, which also rethrows exceptions returned over the channel. Must be called INSIDE a (go ...) or (async ...) block. - Will return nil if closed. - Will park if nothing is available. - Will throw if an Exception is taken from port. - Will return the raw value if it is not a ReadPort - Will fully read through any async result returned
(!<!! v)
An improved macro version of <!!, which also rethrows exceptions returned over the channel. Must be called OUTSIDE a (go ...) or (async ...) block.
An improved macro version of <!!, which also rethrows exceptions returned over the channel. Must be called OUTSIDE a (go ...) or (async ...) block. - Will return nil if closed. - Will block if nothing is available. - Will throw if a Exception is taken from port. - Will return the raw value if it is not a ReadPort - Will fully read through any async result returned
(!<!* coll)
Like !<! but works with collections of async values
Like !<! but works with collections of async values
(->async-reader x)
Creates an AsyncReader to read anything via take!
Creates an AsyncReader to read anything via `take!`
(<! v)
An improved macro version of <!, which also rethrows exceptions returned over the channel. Must be called INSIDE a (go ...) or (async ...) block.
An improved macro version of <!, which also rethrows exceptions returned over the channel. Must be called INSIDE a (go ...) or (async ...) block. - Will return nil if closed. - Will park if nothing is available. - Will throw if an Exception is taken from port. - Will return the raw value if it is not a ReadPort
(<!! v)
An improved macro version of <!!, which also rethrows exceptions returned over the channel. Must be called OUTSIDE a (go ...) or (async ...) block.
An improved macro version of <!!, which also rethrows exceptions returned over the channel. Must be called OUTSIDE a (go ...) or (async ...) block. - Will return nil if closed. - Will block if nothing is available. - Will throw if a Exception is taken from port. - Will return the raw value if it is not a ReadPort
(<!* coll)
Like <! but works with collections of async values
Like <! but works with collections of async values
(async & body)
Asynchronously executes the body, returning immediately to the calling thread. Additionally, any visible calls to !<!, <!, >! and alt!/alts! channel operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed.
async blocks should not (either directly or indirectly) perform operations that may block indefinitely. Doing so risks depleting the fixed pool of go block threads, causing all go block processing to stop. This includes core.async blocking ops (those ending in !!) and other blocking IO.
Returns an instance of the default async-factory which will receive the result of the body when
completed; the pool used can be specified via *thread-pool*
binding.
Asynchronously executes the body, returning immediately to the calling thread. Additionally, any visible calls to !<!, <!, >! and alt!/alts! channel operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed. async blocks should not (either directly or indirectly) perform operations that may block indefinitely. Doing so risks depleting the fixed pool of go block threads, causing all go block processing to stop. This includes core.async blocking ops (those ending in !!) and other blocking IO. Returns an instance of the default *async-factory* which will receive the result of the body when completed; the pool used can be specified via `*thread-pool*` binding.
(async! port & body)
Asynchronously executes the body, returning port
immediately to the
calling thread. Additionally, any visible calls to !<!, <!, >! and alt!/alts!
channel operations within the body will block (if necessary) by
'parking' the calling thread rather than tying up an OS thread.
Upon completion of the operation, the body will be resumed.
The success or failure output will be put! in port
.
async blocks should not (either directly or indirectly) perform operations that may block indefinitely. Doing so risks depleting the fixed pool of go block threads, causing all go block processing to stop. This includes core.async blocking ops (those ending in !!) and other blocking IO.
Returns the provided port which will receive the result of the body when
completed; the pool used can be specified via *thread-pool*
binding.
Asynchronously executes the body, returning `port` immediately to the calling thread. Additionally, any visible calls to !<!, <!, >! and alt!/alts! channel operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed. The success or failure output will be put! in `port`. async blocks should not (either directly or indirectly) perform operations that may block indefinitely. Doing so risks depleting the fixed pool of go block threads, causing all go block processing to stop. This includes core.async blocking ops (those ending in !!) and other blocking IO. Returns the provided port which will receive the result of the body when completed; the pool used can be specified via `*thread-pool*` binding.
(async-> v & call-seq)
Threads the expr through the forms which can return async result. Inserts v as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc.
Threads the expr through the forms which can return async result. Inserts v as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc.
(async->> v & call-seq)
Threads the expr through the forms which can return async result. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc.
Threads the expr through the forms which can return async result. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc.
(async-cancel! item)
Cancels the async item.
Cancels the async item.
(async-cancellable? v)
Determines if v instance-satisfies? AsyncCancellable
Determines if v instance-satisfies? `AsyncCancellable`
(async-cancelled?)
(async-cancelled? item)
Checks if the current executing async item or one of its parents or provided item has been cancelled. Also checks if the thread has been interrupted and restores the interrupt status.
Checks if the current executing async item or one of its parents or provided item has been cancelled. Also checks if the thread has been interrupted and restores the interrupt status.
(async-channel & body)
Asynchronously executes the body, returning immediately to the calling thread. Additionally, any visible calls to !<!, <!, >! and alt!/alts! channel operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed.
async blocks should not (either directly or indirectly) perform operations that may block indefinitely. Doing so risks depleting the fixed pool of go block threads, causing all go block processing to stop. This includes core.async blocking ops (those ending in !!) and other blocking IO.
Returns a channel which will receive the result of the body when
completed; the pool used can be specified via *thread-pool*
binding.
Asynchronously executes the body, returning immediately to the calling thread. Additionally, any visible calls to !<!, <!, >! and alt!/alts! channel operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed. async blocks should not (either directly or indirectly) perform operations that may block indefinitely. Doing so risks depleting the fixed pool of go block threads, causing all go block processing to stop. This includes core.async blocking ops (those ending in !!) and other blocking IO. Returns a channel which will receive the result of the body when completed; the pool used can be specified via `*thread-pool*` binding.
(async-channel-factory)
Creates a core async channel of size 1
Creates a core async channel of size 1
(async-completed? x)
Checks if the provided AsyncCompletableReader
instance is completed?
Checks if the provided `AsyncCompletableReader` instance is completed?
(async-deferred & body)
Asynchronously executes the body, returning immediately to the calling thread. Additionally, any visible calls to !<!, <!, >! and alt!/alts! channel operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed.
async blocks should not (either directly or indirectly) perform operations that may block indefinitely. Doing so risks depleting the fixed pool of go block threads, causing all go block processing to stop. This includes core.async blocking ops (those ending in !!) and other blocking IO.
Returns a Deferred which will receive the result of the body when
completed; the pool used can be specified via *thread-pool*
binding.
Asynchronously executes the body, returning immediately to the calling thread. Additionally, any visible calls to !<!, <!, >! and alt!/alts! channel operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed. async blocks should not (either directly or indirectly) perform operations that may block indefinitely. Doing so risks depleting the fixed pool of go block threads, causing all go block processing to stop. This includes core.async blocking ops (those ending in !!) and other blocking IO. Returns a Deferred which will receive the result of the body when completed; the pool used can be specified via `*thread-pool*` binding.
(async-deferred-factory)
Creates a new Manifold Deferred
Creates a new Manifold Deferred
(async-every? pred coll)
Returns true if (pred x) is logical true for every x in coll, else false.
Returns true if (pred x) is logical true for every x in coll, else false.
(async-for bindings & body)
works like a for macro, but supports core.async operations.
bindings are initially bound and collected, then the data is iterated
over using a loop and the output collected; note that only the body of
the for can contain <!
and !<!
calls. This is implicitly wrapped in
an async
block.
works like a for macro, but supports core.async operations. bindings are initially bound and collected, then the data is iterated over using a loop and the output collected; note that only the body of the for can contain `<!` and `!<!` calls. This is implicitly wrapped in an `async` block.
(async-future & body)
Asynchronously executes the body, returning immediately to the calling thread. Additionally, any visible calls to !<!, <!, >! and alt!/alts! channel operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed.
async blocks should not (either directly or indirectly) perform operations that may block indefinitely. Doing so risks depleting the fixed pool of go block threads, causing all go block processing to stop. This includes core.async blocking ops (those ending in !!) and other blocking IO.
Returns a CompletableFuture which will receive the result of the body when
completed; the pool used can be specified via *thread-pool*
binding.
Asynchronously executes the body, returning immediately to the calling thread. Additionally, any visible calls to !<!, <!, >! and alt!/alts! channel operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed. async blocks should not (either directly or indirectly) perform operations that may block indefinitely. Doing so risks depleting the fixed pool of go block threads, causing all go block processing to stop. This includes core.async blocking ops (those ending in !!) and other blocking IO. Returns a CompletableFuture which will receive the result of the body when completed; the pool used can be specified via `*thread-pool*` binding.
(async-future-factory)
Creates a new CompletableFuture
Creates a new CompletableFuture
(async-map f coll & coll-seq)
Asynchronously returns the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments.
Asynchronously returns the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments.
(async-postwalk f form)
Performs a depth-first, post-order traversal of form. Calls f on each sub-form, uses f's return value in place of the original. Recognizes all Clojure data structures. Consumes seqs as with doall.
Performs a depth-first, post-order traversal of form. Calls f on each sub-form, uses f's return value in place of the original. Recognizes all Clojure data structures. Consumes seqs as with doall.
(async-prewalk f form)
Like postwalk, but does pre-order traversal.
Like postwalk, but does pre-order traversal.
(async-promise & body)
Asynchronously executes the body, returning immediately to the calling thread. Additionally, any visible calls to !<!, <!, >! and alt!/alts! channel operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed.
async blocks should not (either directly or indirectly) perform operations that may block indefinitely. Doing so risks depleting the fixed pool of go block threads, causing all go block processing to stop. This includes core.async blocking ops (those ending in !!) and other blocking IO.
Returns a clojure Promise which will receive the result of the body when
completed; the pool used can be specified via *thread-pool*
binding.
Asynchronously executes the body, returning immediately to the calling thread. Additionally, any visible calls to !<!, <!, >! and alt!/alts! channel operations within the body will block (if necessary) by 'parking' the calling thread rather than tying up an OS thread. Upon completion of the operation, the body will be resumed. async blocks should not (either directly or indirectly) perform operations that may block indefinitely. Doing so risks depleting the fixed pool of go block threads, causing all go block processing to stop. This includes core.async blocking ops (those ending in !!) and other blocking IO. Returns a clojure Promise which will receive the result of the body when completed; the pool used can be specified via `*thread-pool*` binding.
(async-promise-factory)
Creates a new clojure Promise
Creates a new clojure Promise
(async-reduce f coll)
(async-reduce f init coll)
Like core/reduce except, when init is not provided, (f) is used, and async results are read with !<!.
Like core/reduce except, when init is not provided, (f) is used, and async results are read with !<!.
(async-some pred coll)
Concurrently executes (pred x) and returns the first returned
logical true value of (pred x) for any x in coll, else nil.
One common idiom is to use a set as pred, for example
this will return :fred if :fred is in the sequence, otherwise nil:
(some #{:fred} coll). Please beware that unlike clojure.core/some
this function returns the first asynchronous result that completes
and evaluates to logical true, but not necessarily the first one
in sequential order.
Concurrently executes (pred x) and returns the first returned logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll). Please beware that unlike `clojure.core/some` this function returns the first asynchronous result that completes and evaluates to logical true, but not necessarily the first one in sequential order.
(async-walk inner outer form)
Traverses form, an arbitrary data structure. inner and outer are functions. Applies inner to each element of form, building up a data structure of the same type, then applies outer to the result. Recognizes all Clojure data structures. Consumes seqs as with doall.
Traverses form, an arbitrary data structure. inner and outer are functions. Applies inner to each element of form, building up a data structure of the same type, then applies outer to the result. Recognizes all Clojure data structures. Consumes seqs as with doall.
(async? v)
returns true if v instance-satisfies? core.async's ReadPort
returns true if v instance-satisfies? core.async's `ReadPort`
(completable-future & body)
Asynchronously invokes the body inside a completable future, preserves the current thread binding frame,
using by default the ForkJoinPool/commonPool
, the pool used can be specified via *thread-pool*
binding.
Asynchronously invokes the body inside a completable future, preserves the current thread binding frame, using by default the `ForkJoinPool/commonPool`, the pool used can be specified via `*thread-pool*` binding.
(dispatch f)
dispatch the function by submitting it to the *thread-pool*
dispatch the function by submitting it to the `*thread-pool*`
(fixed-threadpool)
(fixed-threadpool n)
Creates a fixed-threadpool, by default uses the number of available processors.
Creates a fixed-threadpool, by default uses the number of available processors.
(rethrow-exception v)
throw v if it is an Exception
throw v if it is an Exception
(set-async-factory! async-factory-fn)
alters the root binding of async-factory to be equal to async-factory-fn
alters the root binding of *async-factory* to be equal to `async-factory-fn`
(unwrap-exception ex)
unwraps an ExecutionException or CompletionException via ex-cause until the root exception is returned
unwraps an ExecutionException or CompletionException via ex-cause until the root exception is returned
(with-async-channel-factory & body)
temporarily binds async-factory to the speficied async-channel-factory
and executes body.
temporarily binds *async-factory* to the speficied `async-channel-factory` and executes body.
(with-async-deferred-factory & body)
temporarily binds async-factory to the speficied async-deferred-factory
and executes body.
temporarily binds *async-factory* to the speficied `async-deferred-factory` and executes body.
(with-async-factory async-factory-fn & body)
temporarily binds async-factory to the speficied async-factory-fn and executes body.
temporarily binds *async-factory* to the speficied async-factory-fn and executes body.
(with-async-future-factory & body)
temporarily binds async-factory to the speficied async-future-factory
and executes body.
temporarily binds *async-factory* to the speficied `async-future-factory` and executes body.
(with-async-promise-factory & body)
temporarily binds async-factory to the speficied async-promise-factory
and executes body.
temporarily binds *async-factory* to the speficied `async-promise-factory` and executes body.
(with-pool pool & body)
Utility macro which binds thread-pool to the supplied pool and then evaluates the body
.
Utility macro which binds *thread-pool* to the supplied pool and then evaluates the `body`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close