Skip to content

Instantly share code, notes, and snippets.

@btd
Created October 16, 2011 14:16
Show Gist options
  • Save btd/1290914 to your computer and use it in GitHub Desktop.
Save btd/1290914 to your computer and use it in GitHub Desktop.
One line fib numbers without recursion and scala.math
val fib = (n:Int) => (0 until n).foldLeft(0, 1) { (x, i) => (x._2, x._1 + x._2) }._1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment