Skip to content

Instantly share code, notes, and snippets.

@zsxwing
Created April 10, 2013 07:16
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 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