[plt-scheme] HTDP Exercise 6.6.2

From: Marco Morazan (morazanm at gmail.com)
Date: Wed Feb 25 08:42:02 EST 2009

On Tue, Feb 24, 2009 at 11:45 PM, aditya shukla
<adityashukla1983 at gmail.com> wrote:
> I was solving the exercise no 6.6.2 from htdp, this is what i came up with.
>
> ;template (define fun-for-circle (lambda(a-circle)(circle-center
> a-circle)(circle-radius a-center)(circle-color a-circle)))
> (define-struct circle (center radius color))
> (define a-circle(make-circle(make-posn 110 30) 30 'yellow))
> (define draw-a-circle(lambda(a-circle)
>                        (draw-circle ( circle-center a-circle)(circle-radius
> a-circle)(circle-color a-circle))))
>
> (start 300 300)
>
> (draw-a-circle a-circle)
>

This may be a very academic point for you right now, but here goes.
The code looks right. That is, it does what the problem asked you to
do. I would strongly suggest, however, that you form the habit now,
not later, of writing down the contract and purpose of every function
you write. In addition, whenever possible include tests using
check-expect.

-- 

Cheers,

Marco


Posted on the users mailing list.