]> git.rkrishnan.org Git - sicp.git/blob - src/sicp/ex3_76.rkt
Solution to 4.44. A bit too verbose. Can be improved by better
[sicp.git] / src / sicp / ex3_76.rkt
1 #lang racket
2
3 (define (smooth stream)
4   (cons-stream (/ (+ (stream-car stream)
5                      (stream-car (stream-cdr stream))) 
6                   2.0)
7                (smooth (stream-cdr stream))))
8
9 (define (make-zero-crossings input-stream last-value)
10   (cons-stream
11    (sign-change-detector (stream-car input-stream) last-value)
12    (make-zero-crossings (stream-cdr input-stream)
13                         (stream-car input-stream))))
14
15 (define zero-crossings (make-zero-crossings (smooth sense-data) 0))
16                
17