From 7bae9f6c273d2ecad8bee324d57802f3ecad6fe3 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com> Date: Sun, 7 Aug 2011 00:51:16 +0530 Subject: [PATCH] added integral to streams library --- src/sicp/streams.rkt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sicp/streams.rkt b/src/sicp/streams.rkt index b68afe1..e4252cd 100644 --- a/src/sicp/streams.rkt +++ b/src/sicp/streams.rkt @@ -120,4 +120,9 @@ (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) -- 2.45.2