// Patterns
r09
Cycle
A linear loop with one shared verb. Every state is reachable from every other state, in order, by repeatedly firing the same action.
Code
const light = sm`
red 'next' → green;
green 'next' → yellow;
yellow 'next' → red;
`;
Graph
Notes
Cycles fall apart when you reach for an enum and a counter. Modeled this way, the machine guarantees you can't skip a state — and adding a fourth phase is a one-line edit.