[plt-scheme] CPS and state machines
Joel Reymont wrote:
> Would anyone have an example of implementing a state machine in
> continuation passing style (CPS)? I'm looking for a simple example
> although it does not have to be.
You might find Shriram's "The Swine before the Perl" fun to read -
although it doesn't answer your question.
<http://technetcast.ddj.com/tnc_play_stream.html?stream_id=644>
>
> I'd like to implement a state machine for a game lobby where on receipt
> of event-1 I would send game summaries, on event-2 player summaries, etc.
> I will then build on this example to implement a poker logic state
> machine.
>
> In the game logic fsm there are events like player-joined and player-left
> and where the game would end when there are not enough players or begin
> when enough players joined and where it would otherwise state in the same
> state.
The question should be seen in this context:
<http://meme.b9.com/cview.html?channel=scheme&date=041204>
<http://meme.b9.com/cview.html?channel=scheme&date=041206>
I'll second Neil's advice to write a simple working implementation
first, and then worry about speed later - if you need it at all.
--
Jens Axel Søgaard