- (state-machine INITIAL (TRIGGER ! STATE -> POSSIBLE-TRANSITIONS ...) ...)syntax
Creates a new state machine whose initial state is INITIAL, each TRIGGER is a procedure that will be injected the state change (set the current state to STATE) / validation (check if STATE is in previous state's POSSIBLE-TRANSITIONS), thus working like a transition callback. INITIAL, STATE and POSSIBLE-TRANSITIONS must be symbols, and there must be a POSSIBLE-TRANSITIONS definition for INITIAL so transitioning is possible.
Transitions (via triggers) should be done in tail call position as to not overflow the stack and also to avoid incorrect-state bugs.