<div dir="ltr">Yep, that's just a limitation within BSL.<div><br></div><div>If you're still wanting to use the student packs and not the full language, considering graduating to Intermediate Student and using locals:</div>
<div><br></div><div><br></div><div><div>(define (image-classify userImage)</div><div> (local [(define imageHeight (image-height userImage))</div><div> (define imageWidth (image-width userImage))]</div><div> (cond [(> imageHeight imageWidth) "tall"]</div>
<div> [(= imageHeight imageWidth) "square"]</div><div> [else "wide"])))</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 19, 2013 at 9:52 AM, Nedim M <span dir="ltr"><<a href="mailto:nedimm@outlook.com" target="_blank">nedimm@outlook.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div dir="ltr"><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-family:inherit;font-size:13px;line-height:16px;white-space:pre-wrap;word-wrap:break-word;color:rgb(43,43,43)">
Hello,
I am having a trouble solving Exercise 19 (How to design programs, second edition):
Define the function image-classify, which consumes an image and produces
"tall" if the image is taller than it is wide, "wide" if it is wider
than it is tall, or "square" if its width and height are the same. See
exercise 10 for ideas.
Here is my code:
(require 2htdp/image)
(define (image-classify userImage)
(define imageHeight (image-height userImage))
(define imageWidth (image-width userImage))
(if (> imageHeight imageWidth)
"tall"
(if (= imageHeight imageWidth)
"square"
"wide"
)
)
)
Here is my code for exercise 10:
(require 2htdp/image)
(define cat <imageOfCat>)
(define catHeight (image-height cat))
(define catWidth (image-width cat))
(if (> catHeight catWidth)
"tall"
(if (= catHeight catWidth)
"square"
"wide"
)
)
Language is beginning student.
It looks like that declaring calculated constant inside function doesn't work. Example:</pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-family:inherit;font-size:13px;line-height:16px;white-space:pre-wrap;word-wrap:break-word;color:rgb(43,43,43)">
<br></pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-family:inherit;font-size:13px;line-height:16px;white-space:pre-wrap;word-wrap:break-word;color:rgb(43,43,43)"><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-family:inherit;white-space:pre-wrap;word-wrap:break-word">
(define (image-classify userImage)
(define imageHeight (image-height userImage))</pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-family:inherit;white-space:pre-wrap;word-wrap:break-word"><br></pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-family:inherit;white-space:pre-wrap;word-wrap:break-word">
<br></pre></pre></div></div><br>____________________<br> Racket Users list:<br> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br><br></blockquote></div><br><br clear="all">
<div><br></div>-- <br>Thank you,<div>Zack Hickman</div><div>Freelance Web Programming/Wordpress Specialization</div><div><a href="http://www.zhickman.com/" target="_blank">http://www.zhickman.com</a></div><div><a href="mailto:zack@zhickman.com" target="_blank">zack@zhickman.com</a></div>
</div><div class="gmail_extra">
</div></div>