[plt-scheme] Help with HTDP chapter Generative Recursion
You have gotten the right answers. Also see
http://www.ccs.neu.edu/home/matthias/HtDP/Extended/index.html
(Prologue)
You may find this more interesting and illuminating. You will need
the svn head for this.
On Feb 2, 2007, at 6:04 PM, Henry Lenzi wrote:
> Hi *
>
> While reading
> http://www.htdp.org/2003-09-26/Book/curriculum-Z-H-32.html
>
> I tried out the followind code snippet:
>
> (define-struct ball (x y delta-x delta-y))
> ;; A ball is a structure:
> ;; (make-ball number number number number)
>
> ;; draw-and-clear : a-ball -> true
> ;; draw, sleep, clear a disk from the canvas
> ;; structural desiignn, Scheme knowledge
> (define (draw-and-clear a-ball)
> (and
> (draw-solid-disk (make-posn (ball-x a-ball) (ball-y a-ball)) 5 'red)
> (sleep-for-a-while DELAY)
> (clear-solid-disk (make-posn (ball-x a-ball) (ball-y a-ball)) 5
> 'red)))
>
> (define (move-ball a-ball)
> (make-ball (+ (ball-x a-ball) (ball-delta-x a-ball))
> (+ (ball-y a-ball) (ball-delta-y a-ball))
> (ball-delta-x a-ball)
> (ball-delta-y a-ball)))
>
> (define WIDTH 100)
> (define HEIGHT 100)
> (define DELAY .1)
>
> (define the-ball (make-ball 10 20 -5 +17))
>
> (and
> (draw-and-clear the-ball)
> (draw-and-clear (move-ball the-ball)))
>
> Setting the langue to HTDP and requiring draw.ss still does not
> result in the expected action. This is the error:
>
> evaluate (start <num> <num>) first
>
>
> I also included a sccreenshot with PLT error arrows.
>
> Anhy help is greatly appreciated.
> TIA.
>
> Henry
> <Imagem1.png>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme