diff options
author | rsiddharth <s@ricketyspace.net> | 2017-02-18 04:59:15 +0000 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2017-02-18 04:59:15 +0000 |
commit | 884d25827772806000fc640aa339a5190704e8ac (patch) | |
tree | f4a49db10fb106f900299b986d03b15f4bb4df24 | |
parent | 5077b12af5fae23d49aa6eea38ebc63c108df265 (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.scm | 2 |
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))))) |