Hello everyone,<br><br><br>#|<br>&nbsp;i will be as brief as i can in explainig the problem. this is the original code of exercise-6.6.6 copied as it is from online version &amp; also from the printed book:<br><br>(draw-a-circle
<br>&nbsp; (move-circle 10<br>&nbsp;&nbsp;&nbsp; (move-circle 10<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (move-circle 10<br>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; (move-circle 10 ... a circle ...)))))<br><br><br>;; the last line says ... a circle....&nbsp; without giving any hint what &quot;a circle&quot; is . i think it is a printing mistake and it should be &quot;...a-circle...&quot;. even after changing it to &quot;a-circle&quot;&nbsp; the function does not work.
<br><br>&nbsp;(draw-a-circle (move-circle 10 (move-circle 10 (move-circle 10 (move-circle 10 a-circle)))))<br><br>and i got following ouput:<br><br>-------------------------------------------<br>Welcome to DrScheme, version 209.
<br>Language: Beginning Student.<br>Teachpack: /usr/lib/plt/teachpack/htdp/draw.ss.<br>true<br>color-circle-center: expects argument of type &lt;struct:color-circle&gt;; given true<br>&gt; <br>--------------------------------------------------
<br><br>&quot;true&quot; is from the innermost expression&nbsp; as it moves the cicle 1st time but next lies error.<br><br>it does not move the circle 4 times as told in the book. I think i know the reason. from my common sense&nbsp; (move-circle 10 a-circle) produces not the circle but &quot;true&quot; &amp; hence &quot;true&quot; goes intop drscheme not the circle itself . I have&nbsp; verified this thing from &quot;stepper&quot; too. since (move-circle..) did not get its 2nd parameter as structue it reports an error for it got &quot;true&quot; - the boolean.
<br><br>i am using DrScheme version 209 on Debian &quot;sarge&quot;.i got 209 version with the debian's 14 CD packs, but i also tried &quot;plt-209-bin-i386-linux.sh&quot; onto Fedora Core but again the same problem.<br><br>
I have studied only upto chapter 6 of HTDP and i do not know any other language, so please<br>keep the answer according to the HTDP's way.<br><br>&nbsp;may you help me? <br><br>thanks in advance<br>|#<br><br>------------------- here is the programme -----------------------------------
<br><br>(define-struct color-circle (center radius color))<br>;; A color-cirlce is a structure: (make-color-circle cen r col)<br>;; where cen is a posn structure, r is a number and col is a symbol.<br><br>;; in-circle? : a-color-circle, a-posn -&gt; boolean
<br>;; to deiermine whether the point lies inside the circle or not.<br><br>#| Template:<br>(define (fun-for-circle a-circle a-posn)<br>&nbsp; ...(color-circle-center a-circle)...<br>&nbsp; ...(color-circle-radius a-circle)...<br>&nbsp; ...(color-circle-color a-circle)...) |#
<br><br>(define (move-circle delta a-circle)<br>&nbsp; (cond<br>&nbsp;&nbsp;&nbsp; [(draw-and-clear-circle a-circle) (translate-circle a-circle delta)]<br>&nbsp;&nbsp;&nbsp; [else a-circle]))<br><br><br>(define (translate-circle a-color-circle delta)<br>&nbsp; (draw-circle (make-posn (+ delta (posn-x (color-circle-center a-color-circle)))
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (posn-y (color-circle-center a-color-circle)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (color-circle-radius a-color-circle)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (color-circle-color a-color-circle)))<br><br><br>(define (draw-and-clear-circle a-circle)
<br>&nbsp; (and (draw-a-circle a-circle)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (sleep-for-a-while 1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (clear-a-circle a-circle)))<br><br>(define (draw-a-circle a-circle)<br>&nbsp; (draw-circle (color-circle-center a-circle)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (color-circle-radius a-circle)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (color-circle-color a-circle)))<br><br>(define (clear-a-circle a-circle)<br>&nbsp; (clear-circle (color-circle-center a-circle)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (color-circle-radius a-circle)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (color-circle-color a-circle)))
<br><br><br>;; test<br>(define a-circle (make-color-circle (make-posn 30 30) 10 'red))<br><br>(start 300 300)<br>(draw-a-circle (move-circle 10 (move-circle 10 (move-circle 10 a-circle))))<br><br>--------------------- end of programme -------------------------------------
<br>