title: Any idea of how to interleave two lists in dr racket?
body: <p>The problem is when lists have a different length, any idea of how to do it?</p>
  
  <p>I have to use functions like map or something like that</p>
  
  <p>This is the code I wrote so far, it works with lists of the same length but it also needs to work with lists of different lengths. Thank you.</p>
  
  <pre><code>(define (interleave list1 list2)
   (flatten [map (lambda (x y) (cons x (cons y null))) list1 list2]))
  </code></pre>
  
  <p>if lists have different length this is what I get:</p>
  
  <p>map: all lists must have same size; arguments were: # '(1 2 3 4 5) '(a b c)</p>
  
  <p>I'm trying to get (1 a 2 b 3 c 4 5)</p>