[racket] Programmatically start a big-bang?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sun Apr 21 11:11:07 EDT 2013

One way is to just write:

(define (my-big-bang ht) (big-bang [on-tick (hash-ref ht 'on-tick)]

and you'd be duplicating the default values but maybe that's enough to get
going for now?


On Sun, Apr 21, 2013 at 10:04 AM, Joe Gibbs Politz <joe at cs.brown.edu> wrote:

> I'd like to write a library function that takes a hash table of
> handlers and starts a running world in big-bang style, for example:
> (my-big-bang
>  0
>  (make-immutable-hash
>   `((on-tick . ,add1)
>     (stop-when . ,(lambda (x) (> x 100))))))
> Is there an interface that I could use to write this?  I suppose I
> could try to generate a syntax object containing an appropriate
> big-bang and eval it, but that seems like a big hammer to wield here.
> I've poked around a little bit in 2htdp/ but haven't found anything
> provided that seems to fit the bill.
> Motivation: I want to support big-bang in a language that doesn't
> support macros (yet), and I don't want to add special-case syntax for
> big-bang.  I'd like the usage in that language (Pyret, which has
> Python-like syntax) to look like:
> big-bang(init, {
>   event_name: event_handler,
>   ...
> })
> Which calls something like `my-big-bang` under the hood.
> Thanks!
> Joe
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130421/addb0f41/attachment.html>

Posted on the users mailing list.