[racket] Advice: simulating stateful API in functional setting

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Sat Jul 16 11:16:10 EDT 2011

On Jul 16, 2011, at 10:33 AM, I wrote:

> some version of [each sprite having a name] may be the least-bad idea so far, including mine :-)

Here's another idea: provide a "sprite+picture" structure, and have all the operations take in and return it.  One could use it directly as a world in big-bang animations, for cases that only involve one sprite.  Problems that require more than one sprite would use a world type that has a picture and a LIST of sprites, but they would pass into the operations only the picture and the relevant sprite, putting both back where they belong after the operation returns.



Stephen Bloch
sbloch at adelphi.edu




Posted on the users mailing list.