[Prev][Next][Index][Thread]
Re: Multiply-keyed collection classes
Andreas Bogk <andreas@andreas.org> wrote:
> neelk@brick.cswv.com (Neel Krishnaswami) writes:
>
> > It's actually the transition table for the state machine that I'm
> > looking to represent as a collection. Since it's a finite function
>
> I usually implement state machines using singleton dispatch:
>
> [example snipped]
>
> The benefit is that you have a well-defined place where you can put
> your code to execute on transition. The downside is that you have no
> explicit transition table (although you still can modify the generic
> function at runtime).
Hey, that's a really good idea! Thanks -- I'm going to build the DFA
with this method, especially since it makes augmenting the machine
with debug information a lot easier. (I think I still need the
explicit table to do the NFA to DFA conversion reasonably efficiently,
though.)
Neel
References: