Skip to content

Instantly share code, notes, and snippets.

@beala
Created May 9, 2016 15:48
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 beala/25af7708a21237f39e51cc0d80d0bffe to your computer and use it in GitHub Desktop.
Save beala/25af7708a21237f39e51cc0d80d0bffe to your computer and use it in GitHub Desktop.
val memoFib: Int => Int = {
Stream.from(0).map{
case 0 => 0
case 1 => 1
case n => memoFib(n-2) + memoFib(n-1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment