Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Iterative (tail recursive) Fibonacci in Scheme (a snippet from SICP)
(define (fib n)
(fib-iter 1 0 n))
(define (fib-iter a b count)
(if (= count 0)
b
(fib-iter (+ a b) a (- count 1))))
@enigmaticape

This comment has been minimized.

Copy link
Owner Author

enigmaticape commented Nov 16, 2012

Fibonacci function as given in SICP, used in discussion of solution to exercises 1.11 (http://www.enigmaticape.com/blog/sicp-exercise-1-11-iterative-function-fn/) and 1.13 (http://www.enigmaticape.com/blog/sicp-exercise-1-13/)

@tobisor

This comment has been minimized.

Copy link

tobisor commented Apr 3, 2017

HOLY M... thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.