title: LISP Determine the depth of a list
body: <p>I'm trying to write a function that determines the depth of a list. 
  So for</p>
  
  <ul>
  <li>(1 2 3 4) => 1</li>
  <li>(1 2 3 (4) ) => 2</li>
  <li>(1 2 3 (4 (5))) => 3</li>
  </ul>
  
  <p>and so on.</p>
  
  <p>This is what I've written so far and it works only for linear lists (<em>depth = 1</em>) and for lists with <em>depth = 2</em>. </p>
  
  <p>I think I'm close to the correct solution but I feel I'm missing something..</p>
  
  <pre><code>(defun detlen (lst count)
      (
          cond
              ((null lst) count)
              ((LISTP (car lst)) (setq count (+ count 1)) (detlen (cdr lst) count))
              (t (detlen (cdr lst) count))
      )
  )
  </code></pre>