Last active
July 10, 2019 18:32
-
-
Save vincent-pradeilles/9022d69c913ee512b96386aa0d284e22 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
let cachedFib: (Int) -> Int = cached { fib, n in | |
if n == 0 || n == 1 { | |
return 1 | |
} else { | |
return fib(n - 1) + fib(n - 2) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment