3.75 Exercise 3.75
If the signal that sign-change-detector should be run on
is meant to contain the values derived from averaging the two
previous values of the input stream, then we must keep track of
the last actual value and the last computed average both – the
last value in order to compute the next average, and the last
average in order to compute whether there was a zero crossing.
(define (make-zero-crossings input-stream last-value last-average) | (let ((avpt (/ (+ (stream-car input-stream) last-value) 2))) | (cons-stream (sign-change-detector avpt last-average) | (make-zero-crossings (stream-cdr input-stream) | (stream-car input-stream) | avpt)))) |
|