<div>Hi All,</div>
<div> </div>
<div>I know now that</div>
<div>helper v </div>
<div> </div>
<div>passes v into 2nd lambda. <br><br></div>
<div class="gmail_quote">On Thu, Jun 2, 2011 at 6:11 AM, Yingjian Ma <span dir="ltr"><<a href="mailto:yingjian.ma1955@gmail.com">yingjian.ma1955@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>Hi Jos and ALL,</div>
<div> </div>
<div>The code is from website</div>
<div> </div>
<div><a href="http://stackoverflow.com/questions/4175626/scheme-recursion-error" target="_blank">http://stackoverflow.com/questions/4175626/scheme-recursion-error</a></div>
<div> </div>
<div>I modified it. It is not about homework. I am learning and evaluating Racket.</div>
<div> </div>
<div>I use Language: racket; memory limit: 128 MB in DrRacket.</div>
<div> </div>
<div>The error I get is </div>
<div> </div>
<div>
<div class="im">> (test 'a '(b a c a))<br></div>. . procedure application: expected procedure, given: '(b a c a) (no arguments)</div>
<div> </div>
<div>I found the problem. I should use </div>
<div> </div>
<div>helper v</div>
<div> </div>
<div>not </div>
<div> </div>
<div>
<div>helper (v)</div>
<div> </div>
<div>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? Does it alway takes the right variable? What happens if the first lambda has 3 parameters and the 2nd lambda has 2 parameters?</div>
</div>
<div> </div>
<div>Also, I want code to keep all the letters that is not a. It does not work for</div>
<div>(test 'a #(b c a b a d)). The result is '(c b). If you know how to generalize it, please let me know.</div>
<div class="gmail_quote"> </div>
<div class="gmail_quote">Thanks a lot.</div>
<div>
<div></div>
<div class="h5">
<div class="gmail_quote"> </div>
<div class="gmail_quote"> </div>
<div class="gmail_quote">On Thu, Jun 2, 2011 at 4:10 AM, Jos Koot <span dir="ltr"><<a href="mailto:jos.koot@telefonica.net" target="_blank">jos.koot@telefonica.net</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div dir="ltr" align="left"><span><font size="2" face="Courier New">Whast you describe seems correct.</font></span></div>
<div dir="ltr" align="left"><span><font size="2" face="Courier New">How about showing me yoyur code after deleting vector->list?</font></span></div>
<div dir="ltr" align="left"><span><font size="2" face="Courier New"></font></span> </div>
<div dir="ltr" align="left"><span><font size="2" face="Courier New">If this is HOMEWORK, send it OFF LIST.</font></span></div>
<div dir="ltr" align="left"><span><font size="2" face="Courier New"></font></span> </div>
<div dir="ltr" align="left"><span><span><font size="2" face="Courier New">What language did you use?</font></span></span></div>
<div dir="ltr" align="left"><span><span><font size="2" face="Courier New"></font></span></span> </div>
<div dir="ltr" align="left"><span><font size="2" face="Courier New">Jos</font></span></div><br>
<blockquote style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px" dir="ltr">
<div dir="ltr" lang="en-us" align="left">
<hr>
<font size="2" face="Tahoma"><b>From:</b> <a href="mailto:users-bounces@racket-lang.org" target="_blank">users-bounces@racket-lang.org</a> [mailto:<a href="mailto:users-bounces@racket-lang.org" target="_blank">users-bounces@racket-lang.org</a>] <b>On Behalf Of </b>Yingjian Ma<br>
<b>Sent:</b> 02 June 2011 08:45<br><b>To:</b> <a href="mailto:users@racket-lang.org" target="_blank">users@racket-lang.org</a><br><b>Subject:</b> [racket] please help to change vector to list<br></font><br></div>
<div>
<div></div>
<div>
<div></div>
<div>Hi ALL,</div>
<div> </div>
<div>I have this code</div>
<div> </div>
<div>(define test <br> (lambda (x v) <br> (define helper <br> (lambda (ls) <br> (cond <br> ((empty? ls) '()) <br> ((empty? (rest ls)) '()) <br>
((equal? (second ls) x) (cons (first ls) (helper (rest ls)))) <br> (else (helper (rest ls)))))) <br> (helper (vector->list v)))) </div>
<div> </div>
<div>When I run it with </div>
<div>> (test 'a #(b a c a))</div>
<div>it returns<br>'(b c)</div>
<div> </div>
<div>Is there a way to use the list such as (test 'a '(b a c a))? I tried to delete vector->list from the last line of the code, but it did not work. Why?</div>
<div> </div>
<div>Thanks a lot</div></div></div></blockquote></div></blockquote></div><br></div></div></blockquote></div><br>