[racket] Three questions related DrRacket
1 I wrote the following code
(define (test x)
(add1 x)
(define (tst x)
(cond
[(= x 1) (add1 x)]
else
(+ x 2))))
and got error msg as
begin (possibly implicit): no expression after a sequence of internal
definitions in: ((add1 x) (define (tst x) (cond ((= x 1) (add1 x)) else (+ x
2))))
What is wrong?
The next two questions were posted a few minutes ago but I was not sure if
they reached the website. I am putting them here
2 I wrote
(define (p x)
(+ x 10)
(* x 10)
)
The result of (p 4) is 40. How can I display 14 and 40?
3 How can I compare two letters in Ascii order? For example, when input
are "x" and "y", the program will tell x is before y.
Thanks a lot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110601/f621d3cd/attachment.html>