Liking cljdoc? Tell your friends :D

cljs.core.async.macros


alt!clj/s≠macro

clj
(alt! & clauses)
cljs
(alt! &form &env & clauses)

Makes a single choice between one of several channel operations, as if by alts!, returning the value of the result expr corresponding to the operation completed. Must be called inside a (go ...) block.

Each clause takes the form of:

channel-op[s] result-expr

where channel-ops is one of:

take-port - a single port to take [take-port | [put-port put-val] ...] - a vector of ports as per alts! :default | :priority - an option for alts!

and result-expr is either a list beginning with a vector, whereupon that vector will be treated as a binding for the [val port] return of the operation, else any other expression.

(alt! [c t] ([val ch] (foo ch val)) x ([v] v) [[out val]] :wrote :default 42)

Each option may appear at most once. The choice and parking characteristics are those of alts!.

Makes a single choice between one of several channel operations,
as if by alts!, returning the value of the result expr corresponding
to the operation completed. Must be called inside a (go ...) block.

Each clause takes the form of:

channel-op[s] result-expr

where channel-ops is one of:

take-port - a single port to take
[take-port | [put-port put-val] ...] - a vector of ports as per alts!
:default | :priority - an option for alts!

and result-expr is either a list beginning with a vector, whereupon that
vector will be treated as a binding for the [val port] return of the
operation, else any other expression.

(alt!
  [c t] ([val ch] (foo ch val))
  x ([v] v)
  [[out val]] :wrote
  :default 42)

Each option may appear at most once. The choice and parking
characteristics are those of alts!.
source (clj)source (cljs)raw docstring

goclj/s≠macro

clj
(go & body)
cljs
(go &form &env & 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 (or the only JS thread when in ClojureScript). Upon completion of the operation, the body will be resumed.

Returns a channel which will receive the result of the body when completed

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 (or
the only JS thread when in ClojureScript). Upon completion of the
operation, the body will be resumed.

Returns a channel which will receive the result of the body when
completed
source (clj)source (cljs)raw docstring

go-loopclj/s≠macro

clj
(go-loop bindings & body)
cljs
(go-loop &form &env bindings & body)

Like (go (loop ...))

Like (go (loop ...))
source (clj)source (cljs)raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close