title: How to print the largest and lowest value in a nested list in Lisp
body: <p>I'm trying to develop a simple function that returns the smallest and largest value in Lisp. So far I have the basic solution working for a single Lisp and here is the code</p>
  
  <pre><code>(defun get-smallest-large (lst &amp;optional (smallest 0) (largest 0))
    (setf smallest (first lst))
    (setf largest 0)
    (dolist (nxt lst)
      (if (&lt; nxt smallest)
          (setf smallest nxt)
          (if (&gt; nxt largest)
              (setf largest nxt))))
    (cons smallest largest))
  </code></pre>
  
  <p>This works like:</p>
  
  <pre><code>(defun get-smallest-large '(1 2 -1 3))
  = (-1 . 3)
  </code></pre>
  
  <p>Now, I can't for the life of me figure out how to change this solution to deal with nested lists so for instance, I entered this:</p>
  
  <pre><code>(defun get-smallest-large '(5 (-2 20 (3)) -6 (-7 13)))
  = (-7 . 20)
  </code></pre>
  
  <p>How would I go about this?</p>