[Haskell-cafe] Re: simulation in the haskell way

Peter Verswyvelen bugfact at gmail.com
Tue Aug 18 18:57:08 EDT 2009


You could read:
http://www.cs.nott.ac.uk/~nhn/FoPAD2007/Talks/nhn-FoPAD2007.pdf
http://haskell.cs.yale.edu/yale/papers/haskell-workshop03/yampa-arcade.pdf
http://www.cs.nott.ac.uk/~nhn/Talks/HW2002-FRPContinued.pdf
http://www.haskell.org/yale/papers/haskellworkshop02/index.html
http://www.haskell.org/haskellwiki/Frag

Basically, even in an imperative solution, if you have complex dependencies
between objects at the same time T, then my experience tells me your into
trouble, it's better to make all objects at time T depend on the state of
other objects at time T-dT. If you absolutely need to know at time T what
the state of another  object is at time T, the network of dependencies needs
to be rearranged dynamically, and you might get different results (or
endless loops if you do it badly) in the case of mutual dependencies. This
is what Elerea does.

On Wed, Aug 19, 2009 at 12:40 AM, Eric Wong <wsysdu at gmail.com> wrote:

> 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
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090818/3c55b042/attachment.html


More information about the Haskell-Cafe mailing list