Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 267 Bytes

iterative-fibonacci-in-scheme.md

File metadata and controls

14 lines (11 loc) · 267 Bytes

Iterative Fibonacci in Scheme

The one in SICP made less sense

I seem to remember adapting the one from Rosetta Code:

(define (fib-iter a b count)
  (if (= count 0)
    a
    (fib-iter b (+ a b) (- count 1))))

(define (fib n)
  (fib-iter 0 1 n))