[racket] Three questions related DrRacket

From: Yingjian Ma (yingjian.ma1955 at gmail.com)
Date: Wed Jun 1 18:24:23 EDT 2011

1  I wrote the following code

(define (test x)
  (add1 x)
  (define (tst x)
    [(= x 1) (add1 x)]
    (+ 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

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>

Posted on the users mailing list.