title: Quicksort in LISP
body: <p>I am trying to do a quicksort using LISP but I am having trouble with my functions output. </p>
  
  <pre><code>(defun qsort (L)
     (cond
     ((null L) nil)
     (t(append
        (qsort (list&lt; (car L) (cdr L)))
        (cons (car L) nil)
        (qsort (list&gt;= (car L) (cdr L)))))))
  
  (defun list&lt; (a b)
      (cond
      (( or(null a)(null b) nil))
      (( &lt; a (car b)) (list&lt; a (cdr b)))
      (t(cons (car b) (list&lt; a (cdr b))))))
  
  (defun list&gt;= (a b)
      (cond
      (( or( null a)(null b) nil))
      (( &gt;= a (car b)) (list&gt; a (cdr b)))
      (t(cons (car b) (list&gt; a (cdr b))))))   
  </code></pre>
  
  <p>My problem being when <em>list&lt;</em> and <em>list>=</em> finish the list always ends with a .T. For instance:</p>
  
  <pre><code>&gt; (list&lt; '4 '(1 5 3 8 2))
  Entering: LIST&lt;, Argument list: (4 (1 5 3 8 2))
   Entering: LIST&lt;, Argument list: (4 (5 3 8 2))
    Entering: LIST&lt;, Argument list: (4 (3 8 2))
     Entering: LIST&lt;, Argument list: (4 (8 2))
      Entering: LIST&lt;, Argument list: (4 (2))
       Entering: LIST&lt;, Argument list: (4 NIL)
       Exiting: LIST&lt;, Value: T
      Exiting: LIST&lt;, Value: (2 . T)
     Exiting: LIST&lt;, Value: (2 . T)
    Exiting: LIST&lt;, Value: (3 2 . T)
   Exiting: LIST&lt;, Value: (3 2 . T)
  Exiting: LIST&lt;, Value: (1 3 2 . T)
  (1 3 2 . T)
  </code></pre>
  
  <p>Why is <em>(4 NIL)</em> evaluating as T?</p>