scala parallel collections degree of parallelism

With the newest trunk, using the JVM 1.6 or newer, use the: collection.parallel.ForkJoinTasks.defaultForkJoinPool.setParallelism(parlevel: Int) This may be a subject to changes in the future, though. A more unified approach to configuring all Scala task parallel APIs is planned for the next releases. Note, however, that while this will determine the number of processors the query … Read more

How to make a right-associative infix operator?

I found a solution. Scala reference says in section 6.12.3 Infix Operations: The associativity of an operator is determined by the operator’s last character. Operators ending in a colon ‘:’ are right-associative. All other operators are left-associative. Therefore it was enough to rename >> to >>:. It took me some time to realize that while … Read more

Scala: short form of pattern matching that returns Boolean

This is exactly why I wrote these functions, which are apparently impressively obscure since nobody has mentioned them. scala> import PartialFunction._ import PartialFunction._ scala> cond(“abc”) { case “def” => true } res0: Boolean = false scala> condOpt(“abc”) { case x if x.length == 3 => x + x } res1: Option[java.lang.String] = Some(abcabc) scala> condOpt(“abc”) … Read more

Is it possible to have tuple assignment to variables in Scala? [duplicate]

This isn’t simply “multiple variable assignment”, it’s fully-featured pattern matching! So the following are all valid: val (a, b) = (1, 2) val Array(a, b) = Array(1, 2) val h :: t = List(1, 2) val List(a, Some(b)) = List(1, Option(2)) This is the way that pattern matching works, it’ll de-construct something into smaller parts, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)