title: Function that consumes two lists and produces a list of all second elements
body: <p>In Dr. Racket, how would I write a function that consumes 2 lists (and each list contains 2 list elements (the first is a string, the second is a number)) and produces a list of all the second elements?</p>
  <p>If this problem is hard to understand, here is an example:</p>
  <pre><code>(second-separator 
        (list (list &quot;JG&quot; 851) (list &quot;Gh&quot; 90)) 
        (list (list &quot;hb&quot; 34) (list &quot;vc&quot; 45) (list &quot;kl&quot; 462)))
  </code></pre>
  <p>Should Produce:</p>
  <pre><code>(list 851 90 34 45 462)
  </code></pre>
  <p>Here is my code so far:</p>
  <pre><code>(define (second-separator los1 los2)
    (cond
      [(and (empty? los1) (empty? los2)) empty]
      [(empty? los1) (cons (second (first los2)) 
                           (second-separator los1 (rest los2)))] 
      [(empty? los2) (cons (second (first los1)) 
                           (second-separator (rest los1) los2))]
      [else (list (second (first los1)) 
                  (second (first los2)) 
                  (second-separator (rest los1) (rest los2)))]))
  </code></pre>
  <p>My code works properly for all cases except for the <code>else</code> case.</p>
  <p>If I plug in the example given above, I end up getting</p>
  <pre><code>(list 851 34 (list 90 45 (list 462))) 
  </code></pre>
  <p>instead of</p>
  <pre><code>(list 851 90 34 45 462)
  </code></pre>
  <p>How would I correct this problem? Thanks a lot for your help.</p>