chickadee » sicp » interleave

interleave s1 s2procedure

Interleaves two streams.

s1
The interleavened stream
s1
The interleaving stream
(define (interleave s1 s2)
  (if (stream-null? s1)
    s2
    (cons-stream (stream-car s1) (interleave s2 (stream-cdr s1)))))