
I used to think about a physical engine in a similar way, and I think it can work. But in some simulations that objects have lots of dependencies on others can be tricky. For instance, object o1 depends on o2, if we represent them in pure values, when we update o2, then o1 must be updated with a new o2 value, isn't it? Recently I want to implement the digital circuit simulation in SICP using Haskell as an exercise. In the Scheme version, each Wire is represented as a function with local states. It records the signal on the wire and actions it will take when the signal changes to activate other wires. How to represent the Wire in haskell purely? If I use State Monad (yes, it's pure :) to repsent a wire with local state, the interaction between connected wires is really tricky to implement. any ideas? thanks. Eric