Created
November 26, 2015 19:24
-
-
Save Saheb/812ae7f5bf166255b8f1 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
def fib_tail(n: Int, a: Int = 1, b: Int = 1):Int = n match | |
{ | |
case 0 => 0 | |
case 1 | 2 => b | |
case _ => fib_tail(n - 1, b, (a + b)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment