From 884d25827772806000fc640aa339a5190704e8ac Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 18 Feb 2017 04:59:15 +0000 Subject: net: Fix `fast-expt-iter` * net/ricketyspace/sicp/one/sixteen.scm (fast-expt-iter): Fix function. --- net/ricketyspace/sicp/one/sixteen.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') 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))))) -- cgit v1.2.3