Chapter 3, Modularity, Objects, and State

Exercise 3.67


1
2
3
4
5
6
7
8
9
10
11
(define (pairs s t)
  (cons-stream
   (list (stream-car s) (stream-car t))
   (interleave
	(interleave
	 (stream-map (lambda (x) (list (stream-car s) x))
                 (stream-cdr t))
	 (stream-map (lambda (x) (list (stream-car t) x))
                 (stream-cdr s))
	 )
    (pairs (stream-cdr s) (stream-cdr t)))))