import com.twitter.algebird._
val dataInt: Array[Int]= Array(1, 1, 2, 2, 3, 3, 4, 4, 5, 5) op(dataInt)
def op[A: Monoid]( xs: Array[A]): Unit = { val m: Monoid[A] = implicitly[Monoid[A]] val res = xs.fold( m.zero )( m.plus ) println("res = " + res) }[error] .../src/main/scala/algebird.scala:36: value zero is not a member of Monoid[A][error] val res = xs.fold( m.zero )( m.plus )./sbt algebird-core/console
scala> import com.twitter.algebird._
import com.twitter.algebird._
scala>
scala> val dataInt: Array[Int]= Array(1, 1, 2, 2, 3, 3, 4, 4, 5, 5)
dataInt: Array[Int] = Array(1, 1, 2, 2, 3, 3, 4, 4, 5, 5)
scala> op(dataInt)
<console>:15: error: not found: value op
op(dataInt)
^
scala>
scala> def op[A: Monoid]( xs: Array[A]): Unit = {
| val m: Monoid[A] = implicitly[Monoid[A]]
| val res = xs.fold( m.zero )( m.plus )
| println("res = " + res)
| }
op: [A](xs: Array[A])(implicit evidence$1: com.twitter.algebird.Monoid[A])Unit
scala> op(dataInt)
res = 30
--
You received this message because you are subscribed to the Google Groups "algebird" group.
To unsubscribe from this group and stop receiving emails from it, send an email to algebird+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.