# [plt-scheme] Combining digits to form numbers

 From: Jos Koot (jos.koot at telefonica.net) Date: Tue Feb 17 15:51:45 EST 2009 Previous message: [plt-scheme] Combining digits to form numbers Next message: [plt-scheme] Combining digits to form numbers Messages sorted by: [date] [thread] [subject] [author]

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

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

_________________________________________________