[racket] Question #3 from Realm of Racket

From: Marco Morazan (morazanm at gmail.com)
Date: Mon Jun 30 22:28:58 EDT 2014

> However, (I’m guessing) using world or w makes it clear that the
functions
> are meant to be used with big-bang.

This is on the right track. You are programming using the universe API.
This API manipulates what changes in a game which it calls a world. What a
world actually is depends on the game/application you are programming. The
universe programmer can define a world as they see fit. Universe provides
the mechanisms needed "behind the scenes" to manipulate worlds. The
programmer must provide a world definition and handlers (used by universe)
to manipulate world instances.

I hope this helps.

Marco



On Mon, Jun 30, 2014 at 12:12 PM, Alexander D. Knauth <alexander at knauth.org>
wrote:

> In this program, a world is just an interval.
>
> All of those w s could be replaced with ivl s, because a world is an
> interval, and the value of the parameter will always be an interval.
>
> However, (I’m guessing) using world or w makes it clear that the functions
> are meant to be used with big-bang.
>
> They could’ve also named the struct world instead of interval, but
> interval is a better name because its a lot more descriptive of what it
> represents.
>
> On Jun 30, 2014, at 11:43 AM, Steve Graham <jsgrahamus at yahoo.com> wrote:
>
> In Guess My Number I see the following definitions:
>
> (define (smaller w)
>   (interval (interval-small w)
>             (max (interval-small w) (sub1 (guess w)))))
> (define (bigger w)
>   (interval (min (interval-big w) (add1 (guess w)))
>             (interval-big w)))
> (define (guess w)
>   (quotient (+ (interval-small w) (interval-big w)) 2))
> (define (render w)
>   (overlay (text (number->string (guess w)) SIZE COLOR) MT-SC))
> (define (render-last-scene w)
>   (overlay (text "End" SIZE COLOR) MT-SC))
> (define (single? w)
>   (= (interval-small w) (interval-big w)))
>
> Why is w (which is world?) included as a parameter?  For instance in
> guess, it seems the only thing needed to calculate it is access to the
> values of interval.
>
>
> Steve
>
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
>
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
>


-- 

Cheers,

Marco

Have a´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´ (¸.·´ * wonderful day! :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140630/ef6b8926/attachment.html>

Posted on the users mailing list.