title: How to count the number of occurrences in a list in lisp
body: <p>The assignment is</p>
  
  <blockquote>
    <p>count-of (symbol list)
    Write a function named count-of that takes two
    parameters, a symbol and a list. Count the number of instances of x in
    the list. Do not count the number of x in any sub-lists within the
    list.</p>
  </blockquote>
  
  <p>I can't figure out how to skip over the sublist in the test list. He is using letters not numbers so I can't use <code>numberp</code>, and when I just have one letter I can't use <code>list-length</code>.  Also I am not sure I and doing the <code>let*</code> then <code>setf</code> correctly but I can't get it to work any other way. </p>
  
  <pre><code>(defun count-of (x list)
    (let* count 0)
    (setf count 0)
    (dolist (y list)
      (if (not a sublist) 
          (setf count (+ count 1)))))
  
  (print (count-of 'a '(a '(a c) d c a)))
  </code></pre>