Skip to content

Instantly share code, notes, and snippets.

@namelos
Last active November 25, 2015 03:24
Show Gist options
  • Save namelos/a347f9df2ef077edca6d to your computer and use it in GitHub Desktop.
Save namelos/a347f9df2ef077edca6d to your computer and use it in GitHub Desktop.
const Immutable = require('immutable')
const Range = Immutable.Range
const fib = n => {
switch (n) {
case 0:
return 1;
case 1:
return 1;
default:
return fib(n - 1) + fib(n - 2)
}
}
const Fib = Range(0, Infinity).map(fib)
console.log(Fib.get(20))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment