Skip to content

Instantly share code, notes, and snippets.

@morteza
Last active June 6, 2018 07:15
Show Gist options
  • Save morteza/5ef9a1aa45e4ce51e323ea65aefbc428 to your computer and use it in GitHub Desktop.
Save morteza/5ef9a1aa45e4ce51e323ea65aefbc428 to your computer and use it in GitHub Desktop.
Fibonacci Sequence in Scala with Immutable Stream
val fibs = 0 #:: fibs.scan(1)(_ + _)
fibs take 5 toList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment