Skip to content

Instantly share code, notes, and snippets.

@wavded
Created April 23, 2014 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wavded/11233792 to your computer and use it in GitHub Desktop.
Save wavded/11233792 to your computer and use it in GitHub Desktop.
TCO in Generators
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