sicp-ex-3.77



<< Previous exercise (3.76) | Index | Next exercise (3.78) >>


meteorgan

  
  
 (define (integral delayed-integrand initial-value dt) 
   (cons-stream initial-value 
                (let ((integrand (force delayed-integrand))) 
                  (if (stream-null? integrand) 
                      the-empty-stream 
                      (integral (delay (stream-cdr integrand)) 
                                (+ (* dt (stream-car integrand)) 
                                   initial-value) 
                                dt)))))