Bohtvaroh

Blogger - Scalaz Motivation - 5

Jun 1st, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.13 KB | None | 0 0
  1. def sum(xs: List[Int], m: Monoid[Int]): Int = xs.foldLeft(m.mzero)(m.mappend)
  2. p(sum(List(1, 2, 3), IntMonoid)) // prints ###> 6
Advertisement
Add Comment
Please, Sign In to add comment