[racket] Newbie question

From: André Toscano (andretoscanocarmo at gmail.com)
Date: Wed Nov 10 17:29:43 EST 2010

Appreciate all the replies I got. Sorry I'm not able to reply back personally to all. I guess we're supposed to just post everything to this list email and let all users check it out, right? 

Can someone please tell me if the following code happens to be the solution to this problem? 
( 5.1.3. at http://htdp.org/2003-09-26/Book/curriculum-Z-H-8.html )

;; check-guess3, exercise 5.1.3.

;; defined function 'guess' as a number made up of three concatenated input digits according to required significance (problem states that digit1 is the least significant, and digit3 is the most significant)

(define (guess digit1 digit2 digit3)
    (+ (* digit3 100) (* digit2 10) digit1))

;; proceeded to define the condition 'check-guess3' that compares the 'guess' number to the 'target' number

(define (check-guess3 digit1 digit2 digit3 target)
  (cond
   [(< (guess digit1 digit2 digit3) target) 'TooSmall]
   [(= (guess digit1 digit2 digit3) target) 'Perfect]
   [(> (guess digit1 digit2 digit3) target) 'TooLarge]))


When I test the function 'check-guess3' at the interactions window, it seems to work fine.
But when I switch over to the gui window and approach the supposed target number, then no matter what I choose it's either 'TooSmall or 'TooLarge. Never get the 'Perfect result like when I test this in the interactions window.

What am I doing wrong?

(My thanks to Jens, Paul and Ken for their replies)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101110/9e779080/attachment.html>

Posted on the users mailing list.