[plt-scheme] Help with HTDP chapter Generative Recursion

From: Henry Lenzi (henry.lenzi at gmail.com)
Date: Fri Feb 2 18:04:27 EST 2007

Hi *

 While reading

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

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Imagem1.png
Type: image/png
Size: 34898 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20070202/40209842/attachment.png>

Posted on the users mailing list.