Skip to content

Instantly share code, notes, and snippets.

@iboss-ptk
Created January 31, 2016 05:22
Show Gist options
  • Save iboss-ptk/3dc5229786e0ae9ecc80 to your computer and use it in GitHub Desktop.
Save iboss-ptk/3dc5229786e0ae9ecc80 to your computer and use it in GitHub Desktop.
val numbers = List(1,2,3,4,5)
numbers.reduce((acc, curr) => acc + curr) // => 15
numbers.foldLeft(0)((acc, curr) => acc + curr) // => 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment