title: Counting all occurences of an atom inside a list? - LISP
body: <p>I need to write a function that counts all occurrences of a given atom inside of a list. This is what I have:</p>
  
  <pre><code>(defun my-count (a L)
      (cond
      ((null L) nil)
      ((equal a (car L))(+ 1 (my-count a (cdr L))))
      (t (my-count a(cdr L)))
      )
  )
  </code></pre>
  
  <p>By my understanding this should work. However when I run a trace I find that when (equals a car L) evaluates to true it makes the recursive call but doesn't initialize the + 1. There is obviously something I am missing.</p>