So I've been playing around with remote actors, and I've run into some difficulties with serialization exceptions. One of my message is an instance of a case class, which itself contains an instance of a list of Path classes. The Path class is defined as follows, and is essentially a collection of Point instances with a precomputed dista...
I'm a Lift newbie and I can't digest it's HTTP request/response cycle yet. Handling REST is thoroughly explained in Lift docs but what I'm looking for is much simpler: how do I access HTTP request body/params in my web service (in Scala code of course) ?
...
I'm considering using SBT for a new scala project, but I'm not sure which CI server - hudson / cruise / whatever has support for it. Any ideas?
I know SBT is a little Maven like, but I don't think it can work as a drop in replacement for Maven in the eyes of a CI server.
...
I am looking for a function that will partition a list into fixed size sublists, exactly what Lists.partition from Google Collections library does.
I couldn't find such method in the Scala Collections API. Am I missing something?
...
I'm beginning Scala. Am I correct understanding that I should define a class as a case class if I'd like it's arguments to be exposed as properties? Does not it introduce any side effects?
...
Reading lines in a foreach loop, a function looks for a value by a key in a CSV-like structured text file. After a specific line is found, it is senseless to continue reading lines looking for something there. How to stop as there is no break statement in Scala?
...
I downloaded Scala 2.8, installed the vim scripts included and tried to type in some Scala code. When I typed in val x = 1 + 2 and hit ENTER, the indentation goes to below the v. When I type in val x = (1 + 2), the indentation is below the x!
If VIM is used by anyone at all for Scala, this bug should've been seen long ago. Or am I the ...
I am using idea 9.0.3 which is the latest release. When I write some scala source code in Idea, it takes several seconds to compile and run. This shouldn't be that slow, Is this normal?
...
I started to learn Scala language and I have a question. How do you think, is it a right way to swap first and last x elements in List in a functional style?
def swap(l: List[Any], x: Int) = {
val l1 = l.take(x)
val l2 = l.slice(x, l.length - x)
val l3 = l.takeRight(x)
l3 ::: l2 ::: l1
}
It doesn't matter what happened if x wo...
In Java and C++ designing program's objects hierarchy is pretty obvious. But beginning Scala I found myself difficult to decide what classes to define to better employ Scala's syntactic sugar facilities (an even idealess about how should I design for better performance). Any good readings on this question?
...
The task is to look for a specific field (by it's number in line) value by a key field value in a simple CSV file (just commas as separators, no field-enclosing quotes, never a comma inside a field), having a header in it's first line.
User uynhjl has given an example (but with a different character as a separator):
val src = Source....
anyone have any experience with lift and how it compares to more widely used frameworks like rails and django?
...
What's the standard way to work with dates and times in Scala? Should I use Java types such as java.util.Date or there are native Scala alternatives?
...
I have the following code in Emacs under scala-mode (from the Scala 2.8 package):
object t1 {
def main (args: List[String]) = {
println("Hello")
}
}
I also have my return key set to newline-and-indent. When I repeatedly hit return after the last brace, it goes to the leftmost column for one blank line. When I press return agai...
My implementation of a getHandler method, which is defined on a Java interface, has failed, and I don't know why. Here is the method signature:
<H extends EventHandler> H getHandler( Type<H> type, int index );
My implementation in Scala is:
def getHandler[H <: com.google.gwt.event.shared.EventHandler]
(aType: Type[H], index: Int)...
Can anyone help this Scala newbie? Previously, we summed a number of quantities in a list of entities with those quantities with:
sum = entities.foldLeft(0.0)(_ + _.quantity)
Now the quantity is an Option[Double], and so is the sum. How can I convert this using idiomatic Scala?
If any entity's quantity is None then the sum should als...
Hi,
Im writing a compiler for university project, and I would like to transform my Abstract Syntax Tree into a Control Flow Graph(CFG).
Im thinking that the nodes(V) in the CFG should be nodes from the AST. I know algorithmically how to construct the edge set (G=(V,E)) but Im having a hard time writing the process a bit more formally
...
Hi
I hope this question hasn't been answered yet somewhere else. Didn't find an answer here.
In my localisation system I've got a class named Language
class Language(val name:String, dict:HashMap[String, String]) {
def apply(key: String):String = (dict get key) match {
case None => "°unknown°"
case Some(s) => s
}
//...
I'm pretty new to Scala, but I thought that one of the strengths of the language was to remove the ceremony, like paranthesis and dots, that exists in for instance Java. So I was pretty confused when I discovered that I can write for instance
str1 equals str2
but not
println "Hello world"
I have surmised that it has something to d...
When I try to omit dots from method invocations, like in this example program:
object Test extends Application {
val baz = new Baz
var foo = baz bar
println(foo)
}
class Baz {
def bar = "bar"
}
I get strange errors. The first one is error: recursive method foo needs type: println foo and the other one is error: type mismatch;...