You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
423 B
12 lines
423 B
2 years ago
|
|
||
|
Exercise 3.64: Write a procedure
|
||
|
stream-limit that takes as arguments a stream and a number (the
|
||
|
tolerance). It should examine the stream until it finds two successive
|
||
|
elements that differ in absolute value by less than the tolerance, and return
|
||
|
the second of the two elements. Using this, we could compute square roots up
|
||
|
to a given tolerance by
|
||
|
|
||
|
|
||
|
(define (sqrt x tolerance)
|
||
|
(stream-limit (sqrt-stream x) tolerance))
|