Created
September 22, 2013 09:14
-
-
Save AKST/6658261 to your computer and use it in GitHub Desktop.
A tail recrusive implementation of the fibonacci squence
This file contains 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
fib :: (Eq a, Num a, Num b) => a -> b | |
fib n = impl n 1 0 | |
where | |
impl 0 _ b = b | |
impl n a b = impl (n - 1) (a + b) a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment