Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fun fibonacciFold(n: Int) =
(2 until n).fold(1 to 1) { (prev, curr), _ ->
curr to (prev + curr)
}.second
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment