[plt-scheme] Combining digits to form numbers

From: Jos Koot (jos.koot at telefonica.net)
Date: Tue Feb 17 15:51:45 EST 2009

Almost right, but you did not yet test it. You are close, though! Introduction of function quess is a good idea. The first two cond lines have bugs. The procedure wont run correctly. After you have made it working (which requires a few keystrokes only), you may want to avoid calling procedure guess twice with the same arguments. But first make it working after your present idea, then simplify.
Jos
  ----- Original Message ----- 
  From: aditya shukla 
  To: Grant Rettke 
  Cc: PLT Scheme ML ; plt-edu-discuss at list.cs.brown.edu 
  Sent: Tuesday, February 17, 2009 8:19 PM
  Subject: Re: [plt-scheme] Combining digits to form numbers


  This how i solved this problem .I have made another procedure for guess thinking that the number returned by it depends on lsb , csb and msb.Therefore it should be another procedure.

  (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))))



  Aditya





------------------------------------------------------------------------------


  _________________________________________________
    For list-related administrative tasks:
    http://list.cs.brown.edu/mailman/listinfo/plt-scheme
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090217/7d03ac28/attachment.html>

Posted on the users mailing list.