Skip to content

Instantly share code, notes, and snippets.

Last active Sep 6, 2018
What would you like to do?
Fibonacci sequence codegolf
// This is the shortest fib function using generators afaik
// Will exceed the call stack eventually
function fib(n) {
const f = function* run(a = 0, b = 1) {
yield a;
yield* run(b, a + b);
return Array(n).fill().map(()=>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment