It looks as though there is no partition method on an Iterator in scala 2.7.5 (there is in 2.8). I'd like to have a partition without losing the laziness of the Iterator, so the following is not an option:
itr.toList.partition( someTest(_) )
Can anyone recommend a way of doing this without implementing my own partition method? For exa...
So I just finished "Programming in Scala" and I've been looking into the changes between Scala 2.7 and 2.8. The one that seems to be the most important is the continuations plugin but I don't understand what its useful for or how it works. I've seen that 'its good for async I/O' but I haven't been able to find out why. Some of the mor...
Or a release candidate? My google-fu fails me.
...
I seem to be missing libraries but I am not certain.
In this file:
object Test {
def main(args: Array[String]) {
for (arg <- args)
println(arg)
}
}
I am not certain what leads to these errors:
Description Resource Path Location Type
Syntax error on token "object", interface expected TestSrc.scala /ScalaDataMining...
I was experimenting with variable constructor arguments for case classes in Scala, but am unable to pass them to the constructor of a case classes' parent:
abstract case class Node(val blocks: (Node => Option[Node])*)
case class Root(val elementBlocks: (Node => Option[Node])*) extends Node(elementBlocks)
the above doesn't compile... i...
In Scala 2.8, there is an object in scala.collection.package.scala:
def breakOut[From, T, To](implicit b : CanBuildFrom[Nothing, T, To]) =
new CanBuildFrom[From, T, To] {
def apply(from: From) = b.apply() ; def apply() = b.apply()
}
I have been told that this results in:
> import scala.collection.breakOut
> val map : Map[Int,...
Following on from another question I asked, I wanted to understand a bit more about the Scala method TraversableLike[A].map whose signature is as follows:
def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That
Notice a few things about this method:
it takes a function turning each A in the traversable into a B
i...
Following on from my breathless confusion, what are some good resources which explain how the new Scala 2.8 collections library has been structured. I'm interested to find some information on how the following fit together:
The collection classes/traits themselves (e.g. List, Iterable)
Why the Like classes exist (e.g. TraversableLike)
...
First note the inflammatory subject title is a quotation made about the manifesto of a UK political party in the early 1980s. This question is subjective but it is a genuine question, I've made it CW and I'd like some opinions on the matter.
Despite whatever my wife and coworkers keep telling me, I don't think I'm an idiot: I have a goo...
Is there something I've got wrong with the following fragment:-
object Imp {
implicit def string2Int(s: String): Int = s.toInt
def f(i: Int) = i
def main(args: Array[String]) {
val n: Int = f("666")
}
}
I get the following from the 2.8 compiler:-
Information:Compilation completed with 1 error and 0 warnings
Information:...
The signature of TraversableLike.flatMap is as follows:
def flatMap[B, Th](f : (A) => Traversable[B])(implicit bf : CanBuildFrom[Repr, B, Th]) : Th
The signature of GenericTraversableTemplate.flatten is:
def flatten[B](implicit asTraversable : (A) => Traversable[B]) : CC[B]
Why is the latter method (which seems to me to differ from...
Whats the status of Lift working with Scala 2.8?
I'm finding fragments of conversations about it on the web. I've been trying tweaking the pom.xml but I'm getting errors from the Lift side of things.
...
(I'm using Scala nightlies, and see the same behaviour in 2.8.0b1 RC4. I'm a Scala newcomer.)
I have two SortedMaps that I'd like to form the union of. Here's the code I'd like to use:
import scala.collection._
object ViewBoundExample {
class X
def combine[Y](a: SortedMap[X, Y], b: SortedMap[X, Y]): SortedMap[X, Y] = {
...
I know this is an exact duplicate, but a year has gone by and Scala seems to be a fast moving thing, so I figure it might be acceptable to ask again:
What is the best IDE for Scala development right now?
...
I'm trying to convert a project over to scala 2.8 from 2.7 and I've run into some difficulty in the code that interacts with Java. Below is a slightly convoluted piece of sample code displaying the problem. Essentially I have class with a member variable of type mutable.Map[K,V] and I can't find a way to pass that through to a method tha...
I'm having trouble converting a java SortedMap into a scala TreeMap. The SortedMap comes from deserialization and needs to be converted into a scala structure before being used.
Some background, for the curious, is that the serialized structure is written through XStream and on desializing I register a converter that says anything that...
I have a two lists, a List[A] and a List[B]. What I want is a Map[A,B] but I want the semantics of zip. So started out like so:
var tuplesOfAB = listOfA zip listOfB
Now I'm not sure how to construct a Map from my tuplesOfAB.
As a follow-up question, I also want to invert my map so that from a Map[A,B] I can create a Map[B,A]. Can an...
I'm just starting to use Apache Buildr and I'm constantly running into the problem of not knowing what repo urls and versions are available for me to use.
For example I want to use Scala 2.8 in a build file, the id i previously used was:
2.8.0-SNAPSHOT
But now this is not found. I also want to use the latest version of Apache POI. If...
In Scala 2.8, I have an immutable map with multiple values for each key:
Map[T,Iterable[U]]
Is there a superior representation? Secondly, how would you generate such a map from
Iterable[(T,U)]
? I am presently using:
def toGroupedMap[T,U](vals: Iterable[(T,U)]): Map[T,Iterable[U]] =
vals.groupBy(_._1).map({ case (s,it) => (s,it....
I'm an 18 years old trainee and I'm discovering scala which I like very much :-).
To get familiar with the scala actors I wrote a small simulation with some gears and one controller. The ActorApplication creates N gears with random speed. The controller calculates a synchronization speed and starts the gear-actors. The gears synchronize ...