[racket] left boundary problem
Nobody who can help me understand what Matthias ment with some remarks
such as this one : Oke, but which other contants ?
Roelof
Op 10-5-2012 18:18, Roelof Wobben schreef:
> Op 10-5-2012 18:08, Matthias Felleisen schreef:
>> On May 10, 2012, at 11:01 AM, Roelof Wobben wrote:
>>
>>> p 10-5-2012 15:33, Matthias Felleisen schreef:
>>>>
>>>> Exercise 1: eliminate all constants from function definition.
>>> (define kat (circle 39 'solid 'red))
>>> (define workspace (empty-scene 1000 200))
>>> (define lengte (image-width workspace))
>>> (define gauge-omtrek (rectangle 1000 20 "outline" "black"))
>>> (define decrease-gauge 0.1)
>>> (define increase-x-cat 3)
>>> (define lengte2 (/ (image-width kat)2))
>>> (define ondergrens (- 0 lengte2))
>>> (define bovengrens (+ lengte lengte2))
>>>
>> Where did the function definitions go?
>
> I did get the idea that I only have to make the constants here.
>
>>
>>
>>> Exercise 2: clearly separate all constants that are freely definable
>>> (image of kat) from those that depend on these (size of kat and
>>> surrounding box). Then change the former to 'strange' values and see
>>> whether the program still makes sense. That's called refactoring for
>>> single points of control, and if you can do it you're well on your
>>> way to real software engineering.
>>>
>>> ; free-definable constant :
>>>
>>> (define kat (circle 39 'solid 'red))
>>> (define workspace (empty-scene 1000 200))
>>> (define decrease-gauge 0.1)
>>> (define increase-x-cat 3)
>>>
>>>
>>> (define decrease-gauge 0.1)
>>>
>>> (define increase-x-cat 3)
>>> (define gauge-omtrek (rectangle 1000 20 "outline" "black"))
>>>
>>>
>>> ;depend constants
>>>
>>> (define lengte (image-width workspace)
>>> (define lengte_cat (image-width cat)
>> Perhaps you should define the above two constants first and then make
>> the others depend on them?
>
>
> Oke, but which other contants ?
>
>
>>
>>
>>> ;strange constants
>>>
>>> (define correctie_kat (/ lengte_cat 2)
>>> (define ondergrens ( - 0 correctie-kat)
>>> (define bovengrens ( + lengte correctie-kat)
>>>
>>> Is this is what you mean ?
>>
>> You clearly haven't finished the exercise. Try modifying the width to
>> 3 (from 1000) and see what happens? Do you have enough dependencies?
>
> I will do that and see what happens.
>
>