Created
April 10, 2013 07:16
-
-
Save zsxwing/5352474 to your computer and use it in GitHub Desktop.
Fibonacci Numbers in Scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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