[racket] please help to change vector to list

From: Yingjian Ma (yingjian.ma1955 at gmail.com)
Date: Thu Jun 2 13:00:36 EDT 2011

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 <sbloch at adelphi.edu> 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.  How does Racket know not pass x to ls as the argument?
>
> "helper" is defined as "(lambda (ls) ...)"
> The only place you call "helper", you give it "(vector->list v)"; you don't
> pass it x, so it doesn't take x.
>
> >   Does it alway takes the right variable?
>
> No, it always takes what is explicitly passed in as arguments :-)
>
> > Also, I want code to keep all the letters that is not a.  It does not
> work for
> > (test 'a #(b c a b a d)).  The result is '(c b).  If you know how to
> generalize it, please let me know.
>
>
> In fact, the program you showed us has quite a number of problems: try
> (test 'a #(b))
> (test 'a #(a a))
> (test 'a #(a b a c))
> for example.
>
> I would fix this program by starting over from scratch: the program as it
> stands is not only buggy but too long and complicated.  My solution, and the
> one I would expect my beginning students to come up with, is about 140
> characters long, not including contract and test cases.
>
>
> Stephen Bloch
> sbloch at adelphi.edu
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110602/6389cb78/attachment.html>

Posted on the users mailing list.