sicp

sicp sandbox.
git clone git://git.ricketyspace.net/sicp.git
Log | Files | Refs

commit 884d25827772806000fc640aa339a5190704e8ac
parent 5077b12af5fae23d49aa6eea38ebc63c108df265
Author: rsiddharth <s@ricketyspace.net>
Date:   Sat, 18 Feb 2017 04:59:15 +0000

net: Fix `fast-expt-iter`

* net/ricketyspace/sicp/one/sixteen.scm (fast-expt-iter): Fix function.

Diffstat:
net/ricketyspace/sicp/one/sixteen.scm | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 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)))))