Questions tagged [scala-2.9]

Version 2.9 of the Scala language for the JVM.

Version 2.9 included many changes, notably the introduction of parallel collections.

Scala is a general purpose programming language principally targeting the Java Virtual Machine. Designed to express common programming patterns in a concise, elegant, and type-safe way, it fuses both imperative and functional programming styles. Its key features are: statically typed; advanced type-system with type inference; function types; pattern-matching; implicit parameters and conversions; operator overloading; full interop with Java.

See for more information.

102 questions
9
votes
1 answer

Strange behavior of Set4 in scala 2.9.1?

Making a migration from 2.8.1 to 2.9.1 found interesting thing. Tried to write this in console: >>import collection.immutable.Set.Set4 >>new Set4[Int](1,2,3,4) It gives: java.lang.Error: Unexpected New at…
Rinat Tainov
  • 1,479
  • 2
  • 19
  • 39
9
votes
2 answers

Getting started with Scala, Scalatest, and Maven

I created a new scala project with the following: mvn org.apache.maven.plugins:maven-archetype-plugin:2.2:generate -DarchetypeGroupId=org.scala-tools.archetypes -DarchetypeArtifactId=scala-archetype-simple -DarchetypeVersion=1.3 …
MrDrews
  • 2,139
  • 2
  • 22
  • 22
8
votes
1 answer

Reference a constructor argument from a trait

In Scala, is it possible for a trait to reference a named constructor argument of the class it is mixed into? The code below doesn't compile because ModuleDao's constructor argument is not a val as defined in the trait. If I add val before the…
Nick
  • 11,475
  • 1
  • 36
  • 47
8
votes
3 answers

Case classes and Proxy behaviour in Scala 2.9

On migrating our code to Scala 2.9 we've found large swathes of it that didn't work and failed silently. We tracked it down to case classes that extend Proxy not being equal. In our code we don't extend Proxy directly, we just extend classes in…
David
  • 1,862
  • 2
  • 22
  • 35
8
votes
1 answer

How can I sort List[Int] objects?

What I want to do is sort List objects in Scala, not sort the elements in the list. For example If I have two lists of Ints: val l1 = List(1, 2, 3, 7) val l2 = List(1, 2, 3, 4, 10) I want to be able to put them in order where l1 > l2. I have…
Mike Lavender
  • 319
  • 1
  • 4
  • 13
7
votes
3 answers

Modifying a large file in Scala

I am trying to modify a large PostScript file in Scala (some are as large as 1GB in size). The file is a group of batches, with each batch containing a code that represents the batch number, number of pages, etc. I need to: Search the file for the…
Andrew Conner
  • 1,436
  • 13
  • 21
7
votes
1 answer

What are main changes from scala 2.8.1 to scala 2.9.1?

I am working on project implemented in scala 2.8.1, want to migrate to scala 2.9.1 and use akka-actors libraries instead of standard, but didn't find good summary of main changes, here what I found: Changes between Scala 2.8 and Scala 2.9 Changes…
Rinat Tainov
  • 1,479
  • 2
  • 19
  • 39
7
votes
1 answer

Why is this not faster using parallel collections?

I just wanted to test the parallel collections a bit and I used the following line of code (in REPL): (1 to 100000).par.filter(BigInt(_).isProbablePrime(100)) against: (1 to 100000).filter(BigInt(_).isProbablePrime(100)) But the parallel version…
Plankalkül
  • 833
  • 8
  • 21
7
votes
1 answer

How does one implement a Hadoop Mapper in Scala 2.9.0?

When I migrated to Scala 2.9.0 from 2.8.1, all of the code was functional except for the Hadoop mappers. Because I had some wrapper objects in the way, I distilled down to the following example: import org.apache.hadoop.mapreduce.{Mapper,…
Chris B
  • 71
  • 2
7
votes
1 answer

How to convert scala.collection.Set to java.util.Set with serializable within an RDD

I have a scala.collection.Set scalaSet : Set[Long]. How will I be able to convert it into a java.util.Set with serializable. I tried the following code, but got java.io.notserializableexception:…
user3658637
  • 95
  • 1
  • 4
7
votes
2 answers

Constructor cannot be instantiated to expected type; p @ Person

I am using scala version : Scala code runner version 2.9.2-unknown-unknown -- Copyright 2002-2011, LAMP/EPFL I was trying the deep case matching construct from here: http://ofps.oreilly.com/titles/9780596155957/RoundingOutTheEssentials.html and the…
tuxdna
  • 8,257
  • 4
  • 43
  • 61
7
votes
1 answer

How should one start on creating a sbt plugin?

I want to create a sbt plugin for Scala project. Please any one suggest me how we start? I referred Plugins documentation but unable to understand steps.
7
votes
1 answer

In which case can Scala 2.10.0 compiler be faster or slower than 2.9.2?

I did a benchmark for compilation time on Scala 2.10.0 and 2.9.2, and have found that 2.10.0 took longer compilation time than 2.9.2. In which case does it happen? Or can Scala 2.10.0 compiler be generally slower than 2.9.2 for certain reasons?
Kenji Yoshida
  • 3,108
  • 24
  • 39
7
votes
3 answers

converting Akka's Future[A] to Future[Either[Exception,A]]

Is there a method in Akka (or in the standard library in Scala 2.10) to convert a Future[A] which might fail into a Future[Either[Exception,A]]? I know that you can write f.map(Right(_)).recover { case e:Exception => Left(e) } It just seems to be…
Kim Stebel
  • 41,826
  • 12
  • 125
  • 142
7
votes
2 answers

What is the fastest way to subtract two arrays in scala

I have two arrays (that i have pulled out of a matrix (Array[Array[Int]]) and I need to subtract one from the other. At the moment I am using this method however, when I profile it, it is the bottleneck. def subRows(a: Array[Int], b: Array[Int],…
Mike Lavender
  • 319
  • 1
  • 4
  • 13