added integral to streams library
authorRamakrishnan Muthukrishnan <vu3rdd@gmail.com>
Sat, 6 Aug 2011 19:21:16 +0000 (00:51 +0530)
committerRamakrishnan Muthukrishnan <vu3rdd@gmail.com>
Sat, 6 Aug 2011 19:21:16 +0000 (00:51 +0530)
src/sicp/streams.rkt

index b68afe1ff0636c15a75de12e8d9192f788dadc9f..e4252cd713915f5fc7bb893e54d654bd8383a027 100644 (file)
                 (stream-cdr t))
     (pairs (stream-cdr s) (stream-cdr t)))))
 
-   
+(define (integral integrand initial-value dt)
+  (define int
+    (cons-stream initial-value
+                 (add-streams (scale-stream integrand dt)
+                              int)))
+  int)