Add 1.16
This commit is contained in:
parent
9e4576c291
commit
149e9dfd32
|
@ -0,0 +1,19 @@
|
||||||
|
; UNFINISHED
|
||||||
|
(define (sqr n)
|
||||||
|
(* n n))
|
||||||
|
|
||||||
|
(define (fast-ext-iter number power product)
|
||||||
|
(cond ((= power 0) product)
|
||||||
|
((even? power) (fast-ext-iter number
|
||||||
|
(/ power 2)
|
||||||
|
(if (= product 1)
|
||||||
|
(sqr number)
|
||||||
|
(sqr product))))
|
||||||
|
(else (fast-ext-iter number
|
||||||
|
(- power 1)
|
||||||
|
(* power product)))))
|
||||||
|
|
||||||
|
(define (fast-ext number power)
|
||||||
|
(fast-ext-iter number power 1))
|
||||||
|
|
||||||
|
(fast-ext 2 8)
|
Loading…
Reference in New Issue