I know alot of Java people have started looking at Scala since it runs on the JVM, and alot of people in the Microsoft world are looking at F#, but what does Ruby have as a natural functional successor?
In a pure FP sense Ruby doesn't lack anything, instead it has too much some may say. A functional language forces the programmer to not...
Why were the case classes without a parameter list deprecated from Scala? And why does compiler suggest to use () as parameter list instead?
EDIT :
Someone please answer my second question... :|
...
I have a class that inherits the Actor trait. In my code, I have a method that creates x numbers of this actor using a loop and another method that simply sends the Finish message to all of them to tell them to terminate. I made the kill method just take an array of Actor since I want to be able to use it with an array of any type of A...
Dear All,
Could you please share your opinion on what is the most elegant and/or efficient way of converting a
java.util.HashMap[
java.lang.String, java.util.ArrayList[
java.util.ArrayList[java.lang.Double]
]
]
(all of the objects are from java.util or java.lang)
to
Map[
String, Array[
Array[Double]...
I've ran into a problem recently while developing with Spring Security. It has an interface GrantedAuthority with following signature:
public interface GrantedAuthority extends Serializable, Comparable
And as for Java 1.5 and later, the interface Comparable takes a type parameter T, which is omitted in Spring Security libraries (obvio...
I want a Map that throws on attempt to overwrite a value for existing key. I tried:
trait Unoverwriteable[A, B] extends scala.collection.Map[A, B] {
case class KeyAlreadyExistsException(e: String) extends Exception(e)
abstract override def + [B1 >: B] (kv: (A, B1)): Unoverwriteable[A, B1] = {
if (this contains(kv _1)) t...
Scala has a language feature to support disjunctions in pattern matching ('Pattern Alternatives').
x match {
case _: String | _: Int =>
case _ =>
}
However, I often need to trigger an action if the scrutinee satisfies PatternA and PatternB (conjunction.)
I created a pattern combinator '&&' that adds this capability. Three l...
fsc (fast scala compiler) is faster than scalac. but during TDD cycles i consume 3 seconds to compile sources over less than 1s to run my tests.. suggestion to reduce compile time near 0?
obviously, buy a faster computer is not an answer :)
i mean use some scala internals to compile source faster as possible
...
I'm developer of Robocode engine. We would like to make Robocode
multilingual and Scala seems to be good match. We have Scala plugin prototype here.
The problem:
Because users are creative programmers, they may try to win battle
different ways. As well robots are downloaded from online database
where anyone could upload one. So gap in s...
I recently learned scala and about to start working/learning Lift framework. Going through the Features and getting started with the framework, I had seen some amazing capabilities of the framework including the reverse ajax and comet. Earlier in my experience I had really really bad experience with the reverse ajax which never scaled. I...
How does one create an @interface in Scala? I honestly feel stupid asking that question, but I can't find the syntax for this anywhere. I know that you can consume them, but how do you actually define new ones in Scala?
Java:
public @interface MyAnnotation { }
Scala:
???
...
Hi I started learning scala a few days back and when learning it, I am comparing it with other FP languages like (Haskell, Erlang) which I had some familiarity with. My Question is Does Scala has Guard sequences available, I went through pattern matching in Scala but is there any concept equivalent to Guards with otherwise and all?
...
I am trying to do some examples programs in scala to get more familiar with the language, For that I am trying to re-implement some of the built in methods in Haskell, Most of these methods I am sure are also implemented in Scala too, But these are just for my practice. I think I can post some of code snippets (not all of them) to get a ...
Hi,
does Scala have an API to do a "chomp" on a String?
Preferrably, I would like to convert a string "abcd \n" to "abcd"
Thanks
Ajay
...
I'm experimenting with using jEdit as my main editor for writing Scala code.
Along side jEdit I'm using Apache Buildr and DTerm. This all works well, except I'm really not sure how I would go about debugging Scala application outside of a large IDE?
Are there recommended practices/tools for debugging outside of an IDE?
...
Hi, I am very new to Scala.
I want to implement a generic matrix class "class Matrix[T]". The only constraint on T should be that T should implement a "+" and a "*" mothod/function. How do I go about doing this?
For example I want to be able to use both Int, Double, and my own defined types e.g. Complex
I was thinking something along ...
How to define this class in scala
data NestedList a = Elem a | List [NestedList a]
This in Haskell means a NestedList is a Type which can contain either Elem or another NestedList. Is it possible to do these kind of recursive definitions in scala?
Actually this is what I am trying to acheive
Check Problem 7 here in this page.
Update...
How does one go about implementing a subtype of Numeric[T]?
I have been looking for at guide on this but haven't found any.
Example of subtypes could be Rational or Complex?
Thanks in advance
Troels
...
I have a set of case classes like this
abstract class Shape
case class Rectangle(width: Int, height: Int) extends Shape
case class Location(x: Int, y: Int, shape: Shape) extends Shape
case class Circle(radius: Int) extends Shape
case class Group(shape: Shape*) extends Shape
where basically Group is an array of shapes. I need t...
In the Scala 2.8 collections framework, what is the difference between view and toStream?
...