(!<! 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 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! 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 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 `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 a channel 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-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-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-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.
Default ExecutorService used, corresponds with a FixedThreadPool as many threads as available processors.
Default ExecutorService used, corresponds with a FixedThreadPool as many threads as available processors.
(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
(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-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