|
|
|
|
|
by delegate
1546 days ago
|
|
I don't speak Rust well, but I can share my perspective from Clojure, where I tend to think in data.
A program is a sequence of immutable functions taking input from the world and reducing that to instructions to mutate the world (aka side effects). The world here can also be some place that stores state.
Ideally mutation is the last step of the pipeline, which takes the instructions and produces the side effects. Or simply input -> fn1 -> fn2 -> fnn -> mutate! Where 'fn' are all immutable. |
|
Example: input “I step forward”, output “monster appears”, next input “I try to shoot it”.
That second input wouldn’t be there if the output weren’t executed.