[plt-scheme] Help with HTDP chapter Generative Recursion

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Fri Feb 2 18:13:32 EST 2007

Henry Lenzi skrev:

...
> (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)))

This and expression calls draw-and-clear.
The function draw-and-clear calls draw-solid-disk, which
is supposed to draw a solid disk in a window. But wait - there
is no window to draw in yet.

Therefore use, say (start 200 200) first in other to get
a window to draw in:

  (define WIDTH 100)
  (define HEIGHT 100)
  (define DELAY .1)

  (define the-ball (make-ball 10 20 -5 +17))

  (start 200 200)

  (and
    (draw-and-clear the-ball)
    (draw-and-clear (move-ball the-ball)))

-- 
Jens Axel Søgaard



Posted on the users mailing list.