[plt-scheme] Combining digits to form numbers
I should have added the following:
Are you using DrScheme? In that case you can check the correct placement of parentheses by placing the cursor right before or after a subform and inspect whether the highlighted part is as expected. You can also set the preferences such that when typing a closing parenthesesis, the corresponding opening parenthesis is shown for a short moment. I use these two tools very frequently. And of course I frequently use Check Syntax.
Jos
----- Original Message -----
From: Jos Koot
To: aditya shukla
Cc: PLT Scheme ML ; plt-edu-discuss at list.cs.brown.edu
Sent: Tuesday, February 17, 2009 11:20 PM
Subject: Re: [plt-scheme] Combining digits to form numbers
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/77d13526/attachment.html>