Created
March 26, 2014 06:40
-
-
Save kkolotyuk/9777871 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defn tail-fibo [n] | |
| (letfn [(fib [current next n] | |
| (if (zero? n) | |
| current | |
| (fib next (+ current next) (dec n))))] | |
| (fib 0N 1N n))) | |
| (tail-fibo 1000000) ;; stackoverflow | |
| (defn recur-fibo [n] | |
| (letfn [(fib [current next n] | |
| (if (zero? n) | |
| current | |
| (recur next (+ current next) (dec n))))] | |
| (fib 0N 1N n))) | |
| (recur-fibo 1000000) ;; works! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment