[racket] display problem
Op 11-4-2012 18:03, Roelof Wobben schreef:
> Op 11-4-2012 15:10, Stephen Bloch schreef:
>> On Apr 11, 2012, at 7:39 AM, Roelof Wobben<r.wobben at home.nl> wrote:
>>
>>> But I see something strange, Both check-expect of the function width
>>> gives as output 18.
>>> But I expect that on a empty (editor-pre verwerker) gives as output 0.
>>>
>>> Am I mistaken or is there something wrong in my functions ?
>> Yes, there's something wrong with your width function. It's nothing
>> subtle or complicated; you can figure it out just by looking at the
>> two-line definition of that function.
>>
>> In addition, the contract of the function is wrong: you say it takes
>> in an image, but your test cases give it an editor instead.
>>
>> More broadly, you're doing the whole problem the hard way. Why do
>> you need to know the width of anything? I would do this whole
>> problem without an image-width, without arithmetic, without a
>> place-image, using the functions in the 2htdp/image library.
>>
>>
>> Stephen Bloch
>> sbloch at adelphi.edu
>
> Oke,
>
> I changed the contract to Editor -> Number.
> When I change the make-editor function the value changed.
> So I think the check-expect is wrong but I have no clue how to change it.
>
> I find the way with overlay and beside more the hard way. I have
> puzzled a lot of time with it without success and this solution cost
> me a half a hour.
>
> Roelof
>
Nobody who can give me a tip what's wrong with the function.
Roelof