Skip to content

Instantly share code, notes, and snippets.

@zsxwing
Created April 10, 2013 07:16
Show Gist options
  • Save zsxwing/5352474 to your computer and use it in GitHub Desktop.
Save zsxwing/5352474 to your computer and use it in GitHub Desktop.
Fibonacci Numbers in Scala
import scala.math.BigInt
lazy val fibs: Stream[BigInt] = BigInt(0) #::
BigInt(1) #::
fibs.zip(fibs.tail).map { n => n._1 + n._2 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment