by Leftium · 2mo ago · 0 comments
Here is an example of a calculation written imperatively. It remains easy to reason about because the actions don't leak out of the function:
function add(ns) {
let total = 0
for (const n of ns) {
total += n
}
return total
}
On the other hand, a deterministic state machine like `a = AddMachine` is harder to reason about because it still matters how many times the action `a.transition(1)` is called. (Note it is possible to implement the state machine as calculations.)https://ericnormand.me/podcast/what-is-an-action
https://livebook.manning.com/book/grokking-simplicity/chapte...
No comments yet.