Skip to content

Instantly share code, notes, and snippets.

@justinhj
Created December 10, 2019 04:24
Show Gist options
  • Save justinhj/11f64069829c6a1f08bde1be8e012900 to your computer and use it in GitHub Desktop.
Save justinhj/11f64069829c6a1f08bde1be8e012900 to your computer and use it in GitHub Desktop.
Foldable[List].fold(List(1,2,3))
// res1: Int = 6
Foldable[List].fold(List("1","2","3"))
// res2: String = "123"
// Or you can use the combineAll function
List(1,2,3).combineAll
// res3: Int = 6
List("1","2","3").combineAll
// res4: String = "123"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment