[racket] Three questions related DrRacket

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

In the first question, "else..." should be inside [].

On Wed, Jun 1, 2011 at 3:24 PM, Yingjian Ma <yingjian.ma1955 at gmail.com>wrote:

> 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/e7dae80d/attachment.html>

Posted on the users mailing list.