Created
June 13, 2017 18:35
-
-
Save nskeip/0cc6a77ae707e8baa481bf8c60d9003d to your computer and use it in GitHub Desktop.
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
fibonacci :: Integer -> Integer | |
fibonacci 0 = 0 | |
fibonacci 1 = 1 | |
fibonacci n = fibohelper n 1 0 | |
fibohelper 1 acc1 acc2 = acc1 | |
fibohelper c acc1 acc2 = fibohelper (c - 1) (acc1 + acc2) acc1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment