summaryrefslogtreecommitdiffstats
path: root/one/eight.scm
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2017-01-14 21:44:28 +0000
committerrsiddharth <s@ricketyspace.net>2017-01-14 21:44:28 +0000
commit19ed602c1ba7dc2b933274f50085c9c4f0f1105c (patch)
tree5f4ddb70cb61cf509d6a74bbfa4ccde0c9227fc5 /one/eight.scm
parent8d6bb0aee4679f874ddfb6f7edd8945852cb9c99 (diff)
one -> net/ricketyspace/sicp
Diffstat (limited to 'one/eight.scm')
-rw-r--r--one/eight.scm38
1 files changed, 0 insertions, 38 deletions
diff --git a/one/eight.scm b/one/eight.scm
deleted file mode 100644
index fb944e7..0000000
--- a/one/eight.scm
+++ /dev/null
@@ -1,38 +0,0 @@
-;;; Under Creative Commons Attribution-ShareAlike 4.0
-;;; International. See
-;;; <https://creativecommons.org/licenses/by-sa/4.0/>.
-
-(define-module (one eight)
- #:export (cube double
- div-three improve
- good-enough? cbrt-iter
- cbrt-sicp))
-
-(use-modules (one six))
-
-(define (cube x)
- (* (square x) x))
-
-(define (double x)
- (* 2 x))
-
-(define (div-three x)
- (/ x 3.0))
-
-(define (improve y x)
- (div-three (+ (/ x (square y))
- (double y))))
-
-(define (good-enough? y x)
- (< (abs (- (cube y) x))
- 0.001))
-
-(define (cbrt-iter y x)
- (if (good-enough? y x)
- y
- (cbrt-iter (improve y x)
- x)))
-
-(define (cbrt-sicp x)
- (cbrt-iter 1.0 x))
-