Structs (was RE: Record selectors)

Luke Gorrie luke@REDACTED
Mon Jan 20 14:40:04 CET 2003


Chris Pressey <cpressey@REDACTED> writes:

> An example of this sort of 'use processes for *everything*' approach might
> be a project I want to try sometime this year, that is, to write a digital
> circuit simulator in Erlang.  Instead of messing with nasty physics
> equations, I think the problem could be modelled with one process per gate
> (or chip). Each chip process would receive a message every time one of
> it's pins changed state, so messages would essentially look like {N, M}
> where N is the pin number and M is either rising_edge or falling_edge. 
> The process itself would take care of 'steady' state by tracking it every
> time a new message came in, and would also produce new messages to send to
> other chips wired to its output pins.
> 
> Doing this with one process per truly concurrent unit should make it
> simple (almost trivial) to implement - but the thought of doing it this
> way with any language besides Erlang gives me shivers.

Have you seen the lovely Scheme one in SICP?

http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-22.html#%_sec_3.3.4

Along with the next little section (3.3.5) that's got to be one of the
coolest things I've seen.

Cheers,
Luke




More information about the erlang-questions mailing list