Skip to content

Instantly share code, notes, and snippets.

@DarkDimius
Last active August 29, 2015 13:57
Show Gist options
  • Save DarkDimius/9726100 to your computer and use it in GitHub Desktop.
Save DarkDimius/9726100 to your computer and use it in GitHub Desktop.
scala> import scala.collection.par._
import scala.collection.par._
scala> import scala.collection.views.BlitzViews._
import scala.collection.views.BlitzViews._
scala> import scala.collection.par.Scheduler.Implicits.sequential
import scala.collection.par.Scheduler.Implicits.sequential
scala> val mymap = new Map[Int,Int](_ + 10)
mymap: collection.views.BlitzViews.Map[Int,Int] = scala.collection.views.BlitzViews$Map@6f912aef
scala> val myfilt = new Filter[Int](_ % 2 == 0)
myfilt: collection.views.BlitzViews.Filter[Int] = scala.collection.views.BlitzViews$Filter@270edeff
scala> val mymap2 = new Map[Int,Double](_ * 1.0)
mymap2: collection.views.BlitzViews.Map[Int,Double] = scala.collection.views.BlitzViews$Map@527cff6b
scala> val mystack = mymap >> myfilt >> mymap2
mystack: collection.views.BlitzViews.ViewTransform[Int,Double] = scala.collection.views.BlitzViews$ViewTransform$$anon$2@77094f0a
scala>
scala> val xs = 0 until 10
xs: scala.collection.immutable.Range = Range(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
scala> val p = xs.toPar
p: scala.collection.par.Par[scala.collection.immutable.Range] = Par(Range(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))
scala> View(p)
res2: collection.views.BlitzViews.BlitzView[Int] = scala.collection.views.BlitzViews$View$$anon$4@7dc552f2
scala> implicitly[scala.collection.par.generic.IsReducable[scala.collection.immutable.Range.Inclusive, Int]]
<console>:18: error: could not find implicit value for parameter e: scala.collection.par.generic.IsReducable[collection.immutable.Range.Inclusive,Int]
implicitly[scala.collection.par.generic.IsReducable[scala.collection.immutable.Range.Inclusive, Int]]
^
scala> implicitly[scala.collection.par.generic.IsReducable[scala.collection.immutable.Range, Int]]
res4: scala.collection.par.generic.IsReducable[scala.collection.immutable.Range,Int] = scala.collection.par.workstealing.Ranges$Scope$$anon$2@77f51b24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment