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 <jsgraha...@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