(-add-node! id x)
(-add-node! id deps f)
[pure] adds a node to the graph, prefer using defnode
id
should be a unique keyword
, preferably namespaced
deps
should be a collection of id
referring to other nodes
f
should by should be a function that takes as first paramter an id
, second
an map with resolved deps, the optional third argument can be anything, if
you need to pass more variables use a map
[pure] adds a node to the graph, prefer using [[defnode]] `id` should be a unique `keyword`, preferably namespaced `deps` should be a collection of `id` referring to other nodes `f` should by should be a function that takes as first paramter an `id`, second an map with resolved deps, the optional third argument can be anything, if you need to pass more variables use a map
create event stream
watcher. argument should be an Event
record.
in fact adds the Event
to the event stream
as soon as the
graph
is built, but cache ensures that each event is only added to the
stream once
create `event stream` watcher. argument should be an [[Event]] record. in fact adds the [[Event]] to the `event stream` as soon as the `graph` is built, but cache ensures that each event is only added to the stream once
(-listen >flow f)
[pure] creates a listener
for the Node
of the dag
, every time the
value of a Node
changes the function is called.
function f
should take two arguments, the first is the listener id
, the
second is the Node
value. returns a function that allows to delete a
listener
use as event
(emit ::listen! id f)
[pure] creates a `listener` for the [[Node]] of the `dag`, every time the value of a [[Node]] changes the function is called. function `f` should take two arguments, the first is the listener `id`, the second is the [[Node]] value. returns a function that allows to delete a `listener` use as event ```clojure (emit ::listen! id f) ```
(-memoize f)
(-memoize ttl-ms f)
faster than [[clojure.core/memoize]], but f
can takes only one argument and
support ttl
faster than [[clojure.core/memoize]], but `f` can takes only one argument and support `ttl`
(-watchable? x)
checks if x
supports add-watch
checks if `x` supports `add-watch`
the whole body of the graph
. it is a proxy for the private nodes_ atom to
make sure we don't hurt ourselves by directly manipulating it
the whole body of the `graph`. it is a proxy for the private nodes_ atom to make sure we don't hurt ourselves by directly manipulating it
(defevent id & args)
declares an event
method.
the macro underneath creates an event
method for the id
returning a
Event
record.
supports ::silent
and ::in-reactor-context
metadata.
declares an [[event]] method. the macro underneath creates an [[event]] method for the `id` returning a [[Event]] record. supports `::silent` and `::in-reactor-context` metadata.
(defnode id & args)
defines the computational graph Node
.
Node
can be a single static value, a variable that supports add-watch
,
or a function
function
Node
may have dependencies on other nodes
. calculations are
incremental and a Node
is recalculated only when dependencies change.
see also -add-node!
defines the computational graph [[Node]]. [[Node]] can be a single static value, a variable that supports `add-watch`, or a `function` `function` [[Node]] may have dependencies on other `nodes`. calculations are incremental and a [[Node]] is recalculated only when dependencies change. see also [[-add-node!]]
(emit e & args)
[pure] add an event
or a sequence of events to the event stream
. the
event
can be either a Event
record, or a keyword
identifying an
event
method
.
returns the value returned by the event or stream
[pure] add an [[event]] or a sequence of events to the `event stream`. the [[event]] can be either a [[Event]] record, or a `keyword` identifying an [[event]] `method`. returns the value returned by the event or `stream`
(emit! e & args)
calls the emit
and immediately execute the returned task
.
returns dataflow
containing the result of the reduction.
calls the [[emit]] and immediately execute the returned `task`. returns `dataflow` containing the result of the reduction.
(emit> e & args)
calls the emit
and immediately reduce
the returned flow
.
returns dataflow
containing the result of the reduction.
calls the [[emit]] and immediately `reduce` the returned `flow`. returns `dataflow` containing the result of the reduction.
declare an event, should return a Event
reocrd. for flexibility supports
up to four arguments, if you need more you should really consider using a map.
declare an event, should return a [[Event]] reocrd. for flexibility supports up to four arguments, if you need more you should really consider using a map.
(event? e)
(event? id e)
checks if e
is instance of Event
record, when id
is also given,
checks furthermore if the [[event-id]] is identical to the id
.
can be used to filter SilentEvent from the event stream
checks if `e` is instance of [[Event]] record, when `id` is also given, checks furthermore if the [[event-id]] is identical to the `id`. can be used to filter SilentEvent from the `event stream`
allows automatic handling of errors arising as a result of Event
function calls
a more functional approach to error handling.
allows automatic handling of errors arising as a result of [[Event]] function calls a more functional approach to error handling.
(reset-graph-inputs! m)
resets the atoms holding the values of the static nodes of the dag
resets the atoms holding the values of the static nodes of the dag
(run!)
[inpure] starts the missionary.core/reactor
[inpure] starts the `missionary.core/reactor`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close