[plt-scheme] on-tick in 2htdp/universe.ss
It's a bug that Viera's students discovered and that I plan on fixing
for the next release of universe. -- Matthias
P.S. I gave her students a (really bad, hacky) patch but it's too
ugly to post in public.
On Apr 4, 2009, at 11:14 AM, Mitchell Wand wrote:
> What is the correct contract for an on-tick handler in the universe
> teachpack?
>
> I'm playing with the universe teachpack, and I'm having trouble
> writing an on-tick clause for a universe.
>
> The help files says clearly:
>
> (on-tick tick-expr)
> tick-expr : (-> [listof world?] UniverseState bundle?)
>
> The one example I could find of a universe with an on-tick handler
> (in universe.ss) says
>
> (universe '()
> (on-new nu)
> (on-msg process)
> #;
> (on-tick (lambda (u x) (printf "hello!\n") (list u)) 1)))
>
> This clearly supplies a function of 2 arguments, though not one
> that apparently matches the contract
> in the help file.
>
> But when I try to say
>
> (define (on-tick-fn worlds s-state)
> (make-bundle worlds s-state empty))
>
> (define (run-server d)
> (universe
> '*
> (on-new on-new-fn)
> (on-msg on-msg-fn)
> (on-tick on-tick-fn 1)
> ))
>
> I get:
>
> > (run-server 1)
> on-tick: procedure of one argument expected as first argument;
> given procedure of 2 arguments
>
> What's up with this? What values are actually sent to the on-tick
> handler?
>
> --Mitch
>
>
>
>
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme