3.64 Exercise 3.64
To define stream-limit, all we need to do is examine the two most recent values of the stream that we have seen and compare their difference to our tolerance. By now, writing this sort of procedure is not difficult.
(define (stream-limit s tolerance) (define (limit-inner last rest) (let ((r (stream-car rest))) (if (< (abs (- last r)) tolerance) r (limit-inner r (stream-cdr rest))))) (limit-inner (stream-car s) (stream-cdr s)))