Created
July 17, 2015 15:13
-
-
Save mjethani/052a1d8e14750695b21a 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
function* fibonacci(n = Infinity) { | |
yield* function* _(a = 0, b = 1) { | |
if (n-- > 0) { | |
yield a; | |
yield* _(b, a + b); | |
} | |
}(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment