[plt-scheme] on-tick in 2htdp/universe.ss

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat Apr 4 15:57:37 EDT 2009

I'm not sure, but it looks like that is a buggy error check. You might
try changing the 1 to a 2 in collects/2htdp/universe.ss and seeing
what happens. (Search for "(define-keywords AllSpec" and go down two
lines, I think.)

Robby

On Sat, Apr 4, 2009 at 10:14 AM, Mitchell Wand <wand at ccs.neu.edu> 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
>
>


Posted on the users mailing list.