summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2017-02-18 04:59:15 +0000
committerrsiddharth <s@ricketyspace.net>2017-02-18 04:59:15 +0000
commit884d25827772806000fc640aa339a5190704e8ac (patch)
treef4a49db10fb106f900299b986d03b15f4bb4df24
parent5077b12af5fae23d49aa6eea38ebc63c108df265 (diff)
net: Fix `fast-expt-iter`
* net/ricketyspace/sicp/one/sixteen.scm (fast-expt-iter): Fix function.
-rw-r--r--net/ricketyspace/sicp/one/sixteen.scm2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ricketyspace/sicp/one/sixteen.scm b/net/ricketyspace/sicp/one/sixteen.scm
index 8bbd735..60bc531 100644
--- a/net/ricketyspace/sicp/one/sixteen.scm
+++ b/net/ricketyspace/sicp/one/sixteen.scm
@@ -22,5 +22,5 @@
(define (fast-expt-iter b n a)
"Excercise 1.16."
(cond ((= n 0) a)
- ((even? n) (fast-expt-iter b (- n 2) (* a (sqr b))))
+ ((even? n) (fast-expt-iter (sqr b) (/ n 2) a))
(else (fast-expt-iter b (- n 1) (* a b)))))