Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

1.2.4 completed (fix)

  • Loading branch information...
commit c915ea327dae5abe4e2bb5e269cc08152b9440fb 1 parent 8ecb5a8
@mgryszko authored
Showing with 15 additions and 3 deletions.
  1. +15 −3 ex1.19.scm
View
18 ex1.19.scm
@@ -5,10 +5,22 @@
(cond ((= count 0) b)
((even? count) (fib-iter a
b
- <??> ; compute p’
- <??> ; compute q’ (/ count 2)))
+ (+ (* p p) (* q q))
+ (+ (* q q) (* 2 p q))
+ (/ count 2)))
(else (fib-iter (+ (* b q) (* a q) (* a p))
(+ (* b p) (* a q))
p
q
- (- count 1)))))
+ (- count 1)))))
+
+(fib 0)
+(fib 1)
+(fib 2)
+(fib 3)
+(fib 4)
+(fib 5)
+(fib 6)
+(fib 7)
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.