[racket] display problem

From: Stephen Bloch (bloch at adelphi.edu)
Date: Wed Apr 11 09:10:36 EDT 2012

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

Posted on the users mailing list.