[plt-scheme] Combining digits to form numbers

From: Jos Koot (jos.koot at telefonica.net)
Date: Tue Feb 17 17:20:40 EST 2009

You still have some parentheses wrong. See my anseer in private mail.
Jos
  ----- Original Message ----- 
  From: aditya shukla 
  To: Jos Koot 
  Cc: PLT Scheme ML ; plt-edu-discuss at list.cs.brown.edu 
  Sent: Tuesday, February 17, 2009 10:47 PM
  Subject: Re: [plt-scheme] Combining digits to form numbers



  I removed the bugs from the cond condition .

  (define check-guess3 (lambda(lsb csb msb target)
                         (cond
                           [(< (guess lsb csb msb) target) 'Toosmall]
                           [(= (guess lsb csb msb) target) 'Perfect]
                           [else 'Toolarge])))
  (define guess (lambda (lsb csb msb)
                  (+(* msb 100)(* csb 10) (* lsb 1))))


  For removing the function call twice with the same argument i can i call it before cond and store the return value in a variable .can it be done like this

  (define check-guess3 (lambda(lsb csb msb target)
                           define guess-n (guess lsb csb msb)
                            (cond
                             [(< guess-n target) 'Toosmall]
                             [(= guess-n target) 'Perfect]
                             [else 'Toolarge])))
  (define guess (lambda (lsb csb msb)
                  (+(* msb 100)(* csb 10) (* lsb 1))))


  After doing this i get the error

  lambda: expected only one expression for the function body, but found at least one extra part

  How can i fix this error?


  Aditya

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090217/199879b0/attachment.html>

Posted on the users mailing list.