[racket] Advice: simulating stateful API in functional setting

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Sat Jul 16 14:28:20 EDT 2011

On Jul 16, 2011, at 1:58 PM, Shriram Krishnamurthi wrote:

> On Sat, Jul 16, 2011 at 11:16 AM, Stephen Bloch <sbloch at adelphi.edu> wrote:
>> Here's another idea: provide a "sprite+picture" structure, and have all the operations take in and return it.
> This is unwieldy beyond measure in our syntax.

Yes, that occurred to me.  One could write a "define-operation" macro that acts like "define", but splits the actual sprite+picture parameter into two parameters before you ever see them.  I would still want to introduce it using sprite+picture directly, and then say "This is a pain; here's an easier syntax."

Or we could give them "match", which would help to split up not only the sprite+picture but the sprite itself.

Stephen Bloch
sbloch at adelphi.edu

Posted on the users mailing list.