Kenny Tilton wrote:Right. Doesn't seem like it scales as well, however. Lots of top-level
>> 1. Just represent state machines simply with an integer or symbol state
>> variable and a case or cond form which switches on the current state. The
>> forms associated with any case/cond clause then determine the next state.
> That's what I have done with some simple machines. Symbols definitely,
namespace pollution. Probably the most simple way to get it done, however.
For simple programs, this seems like what I would use if I didn't have a
macro language built up to define state machines nicely (my eventual goal).
>> 2. Represent each state with a different function, bound at top-level.Thanks, I'm learning. I sense that closures are powerful constructs, but I'm
>> The state machine can then be represented as a list or structure, with
>> those functions operating on it.
>> 3. Represent the state machine with a closure. Basically:
> Not bad.
sort of struggling for how/when to use them. Typically, it seems like you
can always get something done another way, and so I struggle with when to
use that tool.
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.