Skip to content

Instantly share code, notes, and snippets.

@stew
Created January 8, 2014 15:27
Show Gist options
  • Select an option

  • Save stew/8318495 to your computer and use it in GitHub Desktop.

Select an option

Save stew/8318495 to your computer and use it in GitHub Desktop.
scala> List(BigDecimal(1).some, BigDecimal(13).some, BigDecimal(12).some).sequence.map(_.sum)
res14: Option[scala.math.BigDecimal] = Some(26)
scala> List(BigDecimal(1).some, None, BigDecimal(12).some).sequence.map(_.sum)
res15: Option[scala.math.BigDecimal] = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment