about summary refs log tree commit diff stats
path: root/js/games/nluqo.github.io/~bh/61a-pages/Lectures/3.5/fib.scm
blob: 6a2d8e60a9b2aa9f44cc64e4e3bf14b79799a015 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
(define (add-streams s1 s2)(cond((stream-null? s1)s2)
				((stream-null? s2)s1)
				(else (cons-stream (+ (stream-car s1)
						(stream-car s2))
					     (add-streams
					      (stream-cdr s1)
					      (stream-cdr s2))))))

(define fibs (cons-stream 0
			  (cons-stream 1
				       (add-streams (stream-cdr fibs)
						    fibs))))