CS2322
Laboratory Problem 11
Environments
In this problem we wish to study practical applications of environments. Consider the iterative definition for the Fibonacci function:
(define fib-iter
(lambda (int acc1 acc2)
(if (= int 1)
acc2
(fib-iter (sub1 int) acc2 (+ acc1 acc2)))))
Write a definition for the Fibonacci function using letrec to make the iteration local to the fib function.
Lab 11 Scheme Code