[plt-scheme] Help with HTDP chapter Generative Recursion
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
-------------- 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>