fork download
  1. object Main extends App {
  2. import collection.Parallelizable
  3. import collection.parallel.{ParIterable, ForkJoinTaskSupport}
  4. def parN[S, T[S] <: Parallelizable[S, ParIterable[S]]](collection: T[S], n: Int) = {
  5. val parCollection = collection.par
  6. parCollection.tasksupport = new ForkJoinTaskSupport(
  7. new concurrent.forkjoin.ForkJoinPool(n))
  8. parCollection
  9. }
  10. println(parN(Array(1, 2, 3), 2))
  11. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.scala:10: error: inferred type arguments [Int,Array] do not conform to method parN's type parameter bounds [S,T[S] <: scala.collection.Parallelizable[S,scala.collection.parallel.ParIterable[S]]]
  println(parN(Array(1, 2, 3), 2))
          ^
one error found
spoj: The program compiled successfully, but Main.class was not found.
      Class Main should contain method: def main(args: Array[String]).
stdout
Standard output is empty