Skip to content

Instantly share code, notes, and snippets.

@tanishiking
Last active December 24, 2015 16:02
Show Gist options
  • Save tanishiking/9d680c0c86e8c3862cd0 to your computer and use it in GitHub Desktop.
Save tanishiking/9d680c0c86e8c3862cd0 to your computer and use it in GitHub Desktop.
object FibGen {
def main(args: Array[String]): Unit = {
fibGen.take(10).print
}
private[this] lazy val fibGen: Stream[Int] = 0 #:: 1 #:: fibGen.zip(fibGen.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