# Nested Modal Transducers
- A methodology for building hierarchical state machines
in a _purely functional_ setting
(no in-place changes are made to data structures)
- At any given time, each state machine has a _configuration_,
which is a data structure consisting of:
* its _mode_ (the traditional "state indicator": one of a finite,
fixed set of labels)
* its _data_ (the "extended state", including any
counters, flags, timers, etc.)
* a collection of configurations, one for each of the
sub-machines _nested_ within this one
- When a state machine receives an _input_, it may
transition to a new configuration, and produce
zero or more _outputs_
- This is realized with a pure function called a _transducer_
with the signature:
* `(Config × Input) → (Config' × [Output])`
- The transducer for a state machine is responsible for
transitioning all of its sub-machines by calling _their_
transducers on the nested configurations
- In doing so it can intercept the input sent to the
sub-machine, and the outputs returned from the sub-machine,
and manage them as it sees fit
When revisiting a write-up you did 7 years ago that you plan to use again, it sometimes helps to write a summary. So that's what I did today.
Well, and I did a lot of cleaning.
And I bought some shoes