title: How to append two streams?
body: <p>I have got these functions</p>
  
  <pre><code>(define force!
    (lambda (thunk)
      (thunk)))
  
  
  (define stream-head
    (lambda (s n)
      (if (zero? n)
          '()
          (cons (car s)
                (stream-head (force! (cdr s))
                             (1- n))))))
  
  (define make-stream
    (lambda (seed next)
      (letrec ([produce (lambda (current)
                          (cons current
                                (lambda ()
                                  (produce (next current)))))])
        (produce seed))))
  
  
  
  (define make-traced-stream
    (lambda (seed next)
      (letrec ([produce (trace-lambda produce (current)
                          (cons current
                                (lambda ()
                                  (produce (next current)))))])
        (produce seed))))
  
  (define stream-of-even-natural-numbers
    (make-traced-stream 0
                        (lambda (n)
                          (+ n 2))))
  
  (define stream-of-odd-natural-numbers
    (make-traced-stream 1
                        (lambda (n)
                          (+ n 2))))
  </code></pre>
  
  <p>And I need to make a function that appends the last two streams, so that if I run</p>
  
  <pre><code>(stream-head (append-stream stream-of-even-natural-numbers stream-of-odd-natural-numbers) 4)
  
  I get the output (0 2 1 3)
  </code></pre>
  
  <p>Problem is, that the streams are infinite, and I dunno how to make a function that knows when to stop taking input from the first stream and then continue taking input from the last. </p>
  
  <p>Earlier I made the Merge of the two lists, which looks like this; </p>
  
  <pre><code>&gt;  (define (merge-streams s1 s2)  (cons (car s1)  (delay (merge-streams
  &gt; s2 (force!(cdr s1))))))
  
  (stream-head (merge-stream stream-of-even-natural-numbers stream-of-odd-natural-numbers) 10)
  = (0 1 2 3 4 5 6 7 8 9)
  </code></pre>
  
  <p>Here I can delay, and alternate which element from each list that I take.</p>
  
  <p>How can I make a smart procedure to append the lists?</p>