i am trying to solve a problem which is to find out number of occurrence of a symbol in list of symbols. <br><br>;question in a given list find out how many times a symbol occurs in the list.<br>;contract : fun-with-lists s-list * symbol -> number<br>
;purpose : this function takes an s-list and a symbol as input and finds out how many times the symbol occurs in the list.<br>;examples 'a -> () =0 , ('a) =1 , ('b) = 0 , ('b 'c 'a 'a) = 2 , ('b 'c 'd) =0<br>
;template (define fun-with-lists (lambda s-list sym) (cond [(empty? s-list)] [ else (first s-list) fun-with-lists(rest s-list])))<br>(define fun-with-lists (lambda (s-list sym )<br> (cond<br> [(empty? s-list) 0]<br>
[else (cond<br> [(symbol=? (first s-list) sym ) 1]<br> <br> [else (fun-with-lists (rest s-list) sym )])])))<br>
<br><br>I got to this far using the recipe explained in htdp.I am stuck at the point where i can't increment the occurrence of a symbol .Can someone give me a hint.<br><br><br>Aditya <br><br><br><br>