How is the state different from the machine?
How is a machine like a map?
The state itself (mainly) contains two piece of information:
:connecting
, or [:connecting :state2]
.
(see [Nested States]({{< relref "docs/nested.md" >}}) for how to
represnt nested states).How are machine/state connected to the higher level services?
A service is stateful, and we need it for two reasons:
There are two layers of APIs in clj-statecharts:
The below document assumes you have a require
statement like this:
(require '[statecharts.core :as fsm])
Returns the initial state of the machine. It also executes all the entry actions of the initial states, if any.
If you do not want these actions to be executed, use fsm/initialize machine {:exec false}
instead.
If the machine contains delayed transitions, it must have a
:scheduler
key that satisfies the statecharts.delayed.Scheduler
protocol.
Returns the next state based the current state+event. It also executes all the entry/exit/transition actions.
If you do not want these actions to be executed, use fsm/transition machine state event {:exec false}
instead.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close