<div dir="ltr"><div style>One way is to just write:</div><div style><br></div><div style>(define (my-big-bang ht) (big-bang [on-tick (hash-ref ht 'on-tick)] ...etcetcetc...))</div><div style><br></div><div style>and you'd be duplicating the default values but maybe that's enough to get going for now?</div>
<div style><br></div><div style>Robby</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 21, 2013 at 10:04 AM, Joe Gibbs Politz <span dir="ltr"><<a href="mailto:joe@cs.brown.edu" target="_blank">joe@cs.brown.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'd like to write a library function that takes a hash table of<br>
handlers and starts a running world in big-bang style, for example:<br>
<br>
(my-big-bang<br>
0<br>
(make-immutable-hash<br>
`((on-tick . ,add1)<br>
(stop-when . ,(lambda (x) (> x 100))))))<br>
<br>
Is there an interface that I could use to write this? I suppose I<br>
could try to generate a syntax object containing an appropriate<br>
big-bang and eval it, but that seems like a big hammer to wield here.<br>
I've poked around a little bit in 2htdp/ but haven't found anything<br>
provided that seems to fit the bill.<br>
<br>
Motivation: I want to support big-bang in a language that doesn't<br>
support macros (yet), and I don't want to add special-case syntax for<br>
big-bang. I'd like the usage in that language (Pyret, which has<br>
Python-like syntax) to look like:<br>
<br>
big-bang(init, {<br>
event_name: event_handler,<br>
...<br>
})<br>
<br>
Which calls something like `my-big-bang` under the hood.<br>
<br>
Thanks!<br>
Joe<br>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</blockquote></div><br></div>