Finite state transducer library. Intended for data representations of state transitions, leaving actions to consumers of the library.
Finite state transducer library. Intended for data representations of state transitions, leaving actions to consumers of the library.
(action transition)
Yields the first action for a transition
Yields the first action for a transition
(actions transition)
Yields all actions for a transition
Yields all actions for a transition
(and-execute & effects)
Define effects for a state transition
Define effects for a state transition
(invalid-states rules)
Returns a collection of invalid target states used in
Predicate to check whether a given valid ruleset provides a functioning set of rules. Rules are deemed functioning if all target states are known.
Returns a collection of invalid target states used in Predicate to check whether a given valid ruleset provides a functioning set of rules. Rules are deemed functioning if all target states are known.
(next transition)
Yields the next state for a transition
Yields the next state for a transition
(ruleset & rules)
A helper to define a ruleset
A helper to define a ruleset
(transit {:automata.fsm/keys [rules state] :as machine} event)
(transit rules state event)
Given a set of rules for states, a current state and event, figure out the next state and potential side effects to perform.
Transit can either be called on a machine, i.e: a map containing the current state and rules. In this case, an updated machine map will be returned, with a potentially new state and potential actions to perform if any.
When called with the three-arity version, transition rules, state, and event are provided separately. The output is then a transition.
Both arities throw when no possible transition was found
Given a set of rules for states, a current state and event, figure out the next state and potential side effects to perform. Transit can either be called on a *machine*, i.e: a map containing the current state and rules. In this case, an updated machine map will be returned, with a potentially new state and potential actions to perform if any. When called with the three-arity version, transition rules, state, and event are provided separately. The output is then a transition. Both arities throw when no possible transition was found
(transit-to x)
Define the target state for a state transition
Define the target state for a state transition
(upon event new-state & [actions])
Within the context of a state transition definition, add an event transition definition.
Within the context of a state transition definition, add an event transition definition.
(validate-rules rules)
Perform sanity checks on a rule set, intended to be ran when loading rules. Throws on badly formulated rules
Perform sanity checks on a rule set, intended to be ran when loading rules. Throws on badly formulated rules
(with-state state & transitions)
Within the context of a ruleset definition, define transitions from a particular state
Within the context of a ruleset definition, define transitions from a particular state
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close