projects
/
sicp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
750dfba
)
added integral to streams library
author
Ramakrishnan Muthukrishnan
<vu3rdd@gmail.com>
Sat, 6 Aug 2011 19:21:16 +0000
(
00:51
+0530)
committer
Ramakrishnan Muthukrishnan
<vu3rdd@gmail.com>
Sat, 6 Aug 2011 19:21:16 +0000
(
00:51
+0530)
src/sicp/streams.rkt
patch
|
blob
|
history
diff --git
a/src/sicp/streams.rkt
b/src/sicp/streams.rkt
index b68afe1ff0636c15a75de12e8d9192f788dadc9f..e4252cd713915f5fc7bb893e54d654bd8383a027 100644
(file)
--- 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)