[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] State machine using call/cc

From: Joel Reymont
Subject: Re: [Chicken-users] State machine using call/cc
Date: Wed, 8 Dec 2004 12:30:55 +0000

> felix winkelmann wrote:

>So, if I understand you correctly, each "state" is a computation,
>being suspended at its current point in a sequence of operation,

This is the logic that I envision... I'd like to hide Scheme behind one
function named dispatch-request. This function should take in an event in
the form of a sexp and an id and return a sexp or #f. 

Since I'm dealing with players connecting to my server the id would be
the player id. If I get back a sexp I would pass it on to the player and
if I got back #f then I would disconnect the player.

Each player would have a state machine on the Scheme side.

In dispatch-request I would look up the saved continuation for this
player in a hash table or some such. If it was found then I would execute
next-state in this continuation which would return either a sexp or #f. 

The state machine would internally retrieve the continuation of the
current state and run ask the current state for the next state and the
sexp. It seems that all states should share the same continuation
although I might be mistaken here. Maybe each state should save its own
continuation and the "current continuation" should be set to that of the
next state when it's chosen by the current state.

Is my logic correct? Would this be a viable architecture?

    Thanks, Joel

OpenPoker: The Linux of poker software

reply via email to

[Prev in Thread] Current Thread [Next in Thread]