-
-
Save lotharschulz/2c97269489aa7e4f050591eaae8a9577 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
val fibonacci = sequence { | |
yield(1) | |
var cur = 1 | |
var next = 1 | |
while (true) { | |
yield(next) | |
val tmp = cur + next | |
cur = next | |
next = tmp | |
} | |
} | |
println(fibonacci.take(15).joinToString()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment