Skip to content

Instantly share code, notes, and snippets.

@justinhj
Last active December 10, 2019 04:12
Show Gist options
  • Save justinhj/d5ee4fec34873b6cf4a8c0aace117561 to your computer and use it in GitHub Desktop.
Save justinhj/d5ee4fec34873b6cf4a8c0aace117561 to your computer and use it in GitHub Desktop.
import cats.Foldable
// Combining a list with a foldLeft
Foldable[List].foldLeft(List(1,2,3), 0){_ |+| _}
// res1: Int = 6
// Combining a list of string with a foldLeft
Foldable[List].foldLeft(List("1","2","3"), "")(_ |+| _)
// res2: String = "123"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment