Created
April 23, 2014 21:55
-
-
Save wavded/11233792 to your computer and use it in GitHub Desktop.
TCO in Generators
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* fibGen (current, next) { | |
yield current | |
yield* fibGen(next, current + next) | |
} | |
for (var num of fibGen(0,1)); | |
// function* fibGen (current, next) { | |
// ^ | |
// RangeError: Maximum call stack size exceeded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment