Liking cljdoc? Tell your friends :D

reacl-c-basics.programs.core-old

Programs are an abstraction over items, that have a dedicated result, and form an async monad.

Programs are an abstraction over items, that have a dedicated result, and form an async monad.
raw docstring

await-actionclj/s

(await-action item pred & [not-running])

A program that shows the given item to start it, until it emits an action where the given predicate holds, which is then returned as the programs result. Shows not-running when the program is not running, which defaults to [[reacl-c.core/empty]].

A program that shows the given item to start it, until it emits an
action where the given predicate holds, which is then returned as
the programs result. Shows `not-running` when the program is not
running, which defaults to [[reacl-c.core/empty]].
sourceraw docstring

await-action*clj/s

(await-action* f pred)
source

await-stateclj/s

(await-state item & [done-state? not-running])

A program that shows the given item to start it, until its state is a non-nil value, or the given predicate holds, returning that value as the program's result. Shows not-running when the program is not running, which defaults to [[reacl-c.core/empty]].

A program that shows the given item to start it, until its state is a
non-nil value, or the given predicate holds, returning that value as
the program's result. Shows `not-running` when the program is not
running, which defaults to [[reacl-c.core/empty]].
sourceraw docstring

await-state*clj/s

(await-state* f & [done-state?])
source

defn-programclj/smacro

(defn-program name params & body)

A macro just like defn, but where the body is wrapped in do-program.

A macro just like `defn`, but where the body is wrapped in [[do-program]].
sourceraw docstring

do-programclj/smacro

(do-program form & forms)

A monadic do notation for programs.

For example:

(do-program
  [r1 (return 21)]
  (return (* r1 2)))
A monadic do notation for programs.

For example:

```
(do-program
  [r1 (return 21)]
  (return (* r1 2)))
```
sourceraw docstring

fmapclj/s

(fmap f program)

A program that applies f to the result of the given program.

A program that applies f to the result of the given program.
sourceraw docstring

jump-onceclj/s

(jump-once program)
source

not-runningclj/s

(not-running p)

An item representing the program p in the not-running state.

An item representing the program `p` in the not-running state.
sourceraw docstring

parclj/s

(par & programs)
source

program?clj/s

(program? v)

A predicate for programs.

A predicate for programs.
sourceraw docstring

raceclj/s

(race program & programs)

A program running several programms in parallel, until the first one is finished, returning the result of that 'winner'.

A program running several programms in parallel, until the first one
is finished, returning the result of that 'winner'.
sourceraw docstring

returnclj/s

(return v)

A program that immediately returns the given value once when run.

A program that immediately returns the given value once when run.
sourceraw docstring

runnerclj/s

(runner program & [handle-result-f])

An item that runs the given program once, offering an event handler for handling the result of the program.

An item that runs the given program once, offering an event handler
for handling the result of the program.
sourceraw docstring

sequclj/s

(sequ program & programs)

A program consisting of several programs run one after the other, returning the result of the last one.

A program consisting of several programs run one after the other,
returning the result of the last one.
sourceraw docstring

showclj/s

(show item)

A program that just shows the given item, but never completes.

A program that just shows the given item, but never completes.
sourceraw docstring

sleepcljs

(sleep ms)

A program that returns nil after the given number of milliseconds have elapsed.

A program that returns `nil` after the given number of milliseconds
have elapsed.
sourceraw docstring

thenclj/s

(then program cont)

A program that runs program first, and then the program (cont result), where result is the result of the first program.

A program that runs `program` first, and then the program `(cont
result)`, where `result` is the result of the first program.
sourceraw docstring

wrapclj/s

(wrap f program)

A program wrapped in some additional markup, via (f item), where item is the item representing the program in either the running or the non-running state.

A program wrapped in some additional markup, via `(f item)`, where
`item` is the item representing the program in either the running or
the non-running state.
sourceraw docstring

wrap*clj/s

(wrap* f program)

A program wrapped in some additional markup, via (f item running?), where item is the item representing the program, and running? a boolean specifying if the program is in the running state or not.

A program wrapped in some additional markup, via `(f item running?)`,
where `item` is the item representing the program, and `running?` a
boolean specifying if the program is in the running state or not.
sourceraw docstring

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

× close