Re: [racket] please help to change vector to list

2011-06-03 Thread Yingjian Ma
at 1:00 PM, Yingjian Ma > wrote: > > Thank you Stephen. The code does not work in general. I know how to do > it > > now. > > It sounds like you're beginning to learn Racket, which is cool. You > may find the the Quick Start documentation at: > >htt

Re: [racket] please help to change vector to list

2011-06-02 Thread Yingjian Ma
Thank you Stephen. The code does not work in general. I know how to do it now. On Thu, Jun 2, 2011 at 7:45 AM, Stephen Bloch wrote: > > On Jun 2, 2011, at 9:11 AM, Yingjian Ma wrote: > > > Here is another question. In (lambda (ls), it seems ls took the value > from v. Ho

Re: [racket] please help to change vector to list

2011-06-02 Thread Yingjian Ma
Hi All, I know now that helper v passes v into 2nd lambda. On Thu, Jun 2, 2011 at 6:11 AM, Yingjian Ma wrote: > Hi Jos and ALL, > > The code is from website > > http://stackoverflow.com/questions/4175626/scheme-recursion-error > > I modified it. It is not about homewor

Re: [racket] please help to change vector to list

2011-06-02 Thread Yingjian Ma
gt; > -- > *From:* users-boun...@racket-lang.org [mailto: > users-boun...@racket-lang.org] *On Behalf Of *Yingjian Ma > *Sent:* 02 June 2011 08:45 > *To:* users@racket-lang.org > *Subject:* [racket] please help to change vector to list > > Hi

[racket] please help to change vector to list

2011-06-01 Thread Yingjian Ma
Hi ALL, I have this code (define test (lambda (x v) (define helper (lambda (ls) (cond ((empty? ls) '()) ((empty? (rest ls)) '()) ((equal? (second ls) x) (cons (first ls) (helper (rest ls (else (helper (rest ls)) (helper (vecto

Re: [racket] Three questions related DrRacket

2011-06-01 Thread Yingjian Ma
ent Language levels, this > function would be illegal (and it might give you some insight into how > this programming style works). > > On Wed, Jun 1, 2011 at 9:19 PM, Justin Zamora wrote: > > On Wed, Jun 1, 2011 at 7:22 PM, Yingjian Ma > wrote: > >> > >> In my

Re: [racket] Three questions related DrRacket

2011-06-01 Thread Yingjian Ma
..)))]) > (add1 x)) > > I think all your define's are supposed to come before any function > applications. > > On 1 June 2011 23:24, Yingjian Ma wrote: > >> 1 I wrote the following code >> >> (define (test x) >> (add1 x) &g

Re: [racket] Three questions related DrRacket

2011-06-01 Thread Yingjian Ma
In the first question, "else..." should be inside []. On Wed, Jun 1, 2011 at 3:24 PM, Yingjian Ma wrote: > 1 I wrote the following code > > (define (test x) > (add1 x) > (define (tst x) > (cond > [(= x 1) (add1 x)] > else > (+ x 2))

[racket] Three questions related DrRacket

2011-06-01 Thread Yingjian Ma
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 (+

[racket] two question about DrRacket

2011-06-01 Thread Yingjian Ma
Hi all, 1 I wrote (define (p x) (+ x 10) (* x 10) ) The result of (p 4) is 40. How can I display 14 and 40? 2 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 _