title: Understanding Deep Reverse
body: <p>Say I have the list '(1 2 3 (4 5 6) 7 8 9). It should return (9 8 7 (6 5 4) 3 2 1) using the following code below. I'm trying to understand how this iterative process works. Showing how this is done step by step would be very helpful. </p>
  
  <p>The part I get confused the most is when deep-reverse is called twice at this point<br>
             (append 
             (deep-reverse (cdr lst)) 
             (list (deep-reverse (car lst))))) </p>
  
  <p>I don't know what happens then.</p>
  
  <pre><code>(define (deep-reverse lst) 
     (cond ((null? lst) '() ) 
           ((pair? (car lst)) 
            (append 
             (deep-reverse (cdr lst)) 
             (list (deep-reverse (car lst))))) 
           (else 
            (append 
             (deep-reverse (cdr lst)) 
             (list (car lst)))))) 
  </code></pre>