3.76 Exercise 3.76
The smooth procedure is simple to write by now:
(define (smooth stream) | (if (stream-null? stream) | the-empty-stream | (let ((first (stream-car stream)) | (rest (stream-cdr stream))) | (if (stream-null? rest) | the-empty-stream | (let ((second (stream-car rest))) | (cons-stream (/ (+ first second) 2) | (smooth rest))))))) |
|
Now the definition of make-zero-crossings is as elegant
as it was before:
(define (make-zero-crossings input-stream) | (let ((smoothed (smooth input-stream))) | (stream-map sign-change-detector | smoothed | (cons-stream 0 smoothed)))) |
|