<div>I finished it. The purpose of the function is to count the occurrance of a letter in a list. Ex:</div>
<div> </div>
<div>(count-matches &#39;x &#39;()) should be 0</div>
<div>(count-matches &#39;x &#39;(a b x)) should be 1 </div>
<div>(count-matches &#39;x &#39;(x b x)) should be 2 </div>
<div> </div>
<div>The keywords I can use are limited. Thank you all for the help. Another I need to write is to remove duplicated items from the list.</div>
<div> </div>
<div>It seems that under cond, one condition can only take one expression. What can I do if I want to do two statements?</div>
<div> </div>
<div>Here is the code. </div>
<div> </div>
<div>(define (count-matches s l) <br> (define (addone s l x)<br> (cond<br> [(empty? l) x]<br> [(equal? s (first l)) (addone s (rest l) (+ 1 x))]<br> [else (addone s (rest l) x)]))<br> (addone s l 0))</div>

<div> </div>
<div> </div>
<div class="gmail_quote">On Tue, May 31, 2011 at 12:31 PM, Yingjian Ma <span dir="ltr">&lt;<a href="mailto:yingjian.ma1955@gmail.com">yingjian.ma1955@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Thank you for letting me know. I&#39;ll use the user list instead of this board in the future.
<div>
<div></div>
<div class="h5"><br>
<div class="gmail_quote"> </div>
<div class="gmail_quote">On Tue, May 31, 2011 at 10:59 AM, Stephen Bloch <span dir="ltr">&lt;<a href="mailto:sbloch@adelphi.edu" target="_blank">sbloch@adelphi.edu</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div><br>On May 31, 2011, at 12:01 PM, Yingjian Ma wrote:<br><br></div>
<div>&gt; I am new to Racket. I did not expect that output is &quot;#&lt;procedure:...uments...&quot;. It is like an error message to me.<br><br></div>Of course you didn&#39;t expect it; that&#39;s the way bugs happen. Marijn&#39;s point is that the &quot;#&lt;procedure: ...&quot; is actually the RETURNED VALUE from your function, not an error message. The real question is, why is your function returning a function rather than a number? (It&#39;s the &quot;lambda&quot;.)<br>
<br>Have you written a collection of test cases for this function? Have you listed, inside the body of the function, an &quot;inventory&quot; of available expressions you&#39;re likely to need? You&#39;re correctly testing whether the list is empty, and if not, you&#39;re correctly testing whether the first thing in the list matches what you&#39;re looking for, but if it is, you&#39;re returning a function rather than a number as I think you intended.<br>
<br>And as somebody pointed out, this sort of question belongs on the racket or plt-edu list, not on the racket-dev list (which is for people developing and maintaining Racket itself, not people learning to program in it).<br>
<font color="#888888"><br><br>Stephen Bloch<br><a href="mailto:sbloch@adelphi.edu" target="_blank">sbloch@adelphi.edu</a><br><br></font></blockquote></div><br></div></div></blockquote></div><br>