scala-2.8 Questions

3

Solved

Scala is a wonderful language, but I wonder how could be improved if it had it's own runtime? I.e. what design choices were made because of JVM choice?
Frontlet asked 21/4, 2010 at 12:7

2

Solved

scala> val a = Array [Double] (10) a: Array[Double] = Array(10.0) scala> val a = new Array [Double] (10) a: Array[Double] = Array(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) Why thes...
Ecumenicalism asked 23/4, 2010 at 16:17

3

Solved

I'm switching from scala 2.7 and ordered to scala 2.8 and using ordering. It looks quite straight forward but I was wondering could I make it a little less verbose. For example: scala> case cla...
Maupin asked 21/4, 2010 at 14:35

5

Solved

This simple test, of course, works as expected: scala> var b = 2 b: Int = 2 scala> b += 1 scala> b res3: Int = 3 Now I bring this into scope: class A(var x: Int) { def +=(y:Int) { this.x +...
Epicurus asked 21/4, 2010 at 13:0

2

Solved

While experimenting with some stuff on the REPL, I got to a point where I needed something like this: scala> class A(x:Int) { println(x); def ==(a:A) : Boolean = { this.x == a.x; } } Just a sim...
Jannery asked 21/4, 2010 at 1:42

2

Solved

This question isn't meant as flame-bait! As it might be apparent, I've been looking at Scalaz recently. I'm trying to understand why I need some of the functionality that the library provides. Here...
Warmup asked 1/4, 2010 at 12:20

1

Solved

There is a trait called Kleisli in the scalaz library. Looking at the code: import scalaz._ import Scalaz._ type StringPair = (String, String) val f: Int => List[String] = (i: Int) => List(...
Aldercy asked 1/4, 2010 at 10:56

1

Solved

Following watching Nick Partidge's presentation on deriving scalaz, I got to looking at this example, which is just awesome: import scalaz._ import Scalaz._ def even(x: Int) : Validation[NonEmptyL...
Inhabitant asked 30/3, 2010 at 12:51

1

In trying to write an API I'm struggling with Scala's collections in 2.8(.0-beta1). Basically what I need is to write something that: adds functionality to immutable sets of a certain type where...
Richart asked 28/3, 2010 at 22:48

1

Solved

Newbie question since I'm not up to speed using maven at all. I'm trying to use scala + lift using scala 2.8, environment is a win7 box if that matters. I create a basic project using: mvn arch...
Weber asked 23/3, 2010 at 18:59

2

Solved

I'm looking to create a document like this: <root/> That I can add children to programatically. Theoretically, it would look like this: val root_node_name = "root" val doc = <{root_nod...
Tarter asked 19/3, 2010 at 12:54

2

Solved

I'm trying to match on an option group in Scala 2.8 (beta 1) with the following code: import scala.xml._ val StatementPattern = """([\w\.]+)\s*:\s*([+-])?(\d+)""".r def buildProperty(input: Stri...
Niggling asked 17/3, 2010 at 10:31

2

Solved

Does Scala have a version of Rubys' each_slice from the Array class?
Aborticide asked 16/3, 2010 at 16:16

3

Solved

I consider refactoring few method signatures that currently take parameter of type List or Set of concrete classes --List[Foo]-- to use repeated parameters instead: Foo*. Update: Following reas...

2

Solved

I've been building out some annotated domain classes in Scala 2.8.0 using Hibernate Annotations 3.4.0. It's been working fine, except that there are certain annotations which take an array as a par...
Brennabrennan asked 15/3, 2010 at 15:40

2

Solved

I'm struggling to understand what precisely does it mean when a value has type A @cpsParam[B,C] and what types of this form should I assign to my values when using the delimited continuations facil...
Longoria asked 13/3, 2010 at 7:46

2

Solved

In Scala 2.8 is there a way to overload constructors of a case class? If yes, please put a snippet to explain, if not, please explain why?
Gayla asked 8/3, 2010 at 11:4

2

Solved

trait NotNull {} I've been trying to see how this trait can guarantee that something is not null and I can't figure it out: def main(args: Array[String]) { val i = List(1, 2) foo(i) //(*) } ...
Gahl asked 25/2, 2010 at 16:8

1

Solved

I have seen this usage of Function.tupled example in another answer: Map(1 -> "one", 2 -> "two") map Function.tupled(_ -> _.length). It works: scala> Map(1 -> "one", 2 -> "two"...
Strappado asked 1/3, 2010 at 6:51

3

Solved

I just stumbled on one of Tony Morris' blog-posts about Java and a fundamental problem with the language: that of defining a bespoke equality-relation for a collection. This is something that I thi...
Acceleration asked 26/2, 2010 at 12:55

2

Solved

I have a Java class that logs stuff which has a method like this: void info(Object message, Object... params); In Scala, I've created a wrapper around such call that looks like this: def info(m...
Tyrannosaur asked 25/2, 2010 at 13:19

2

Solved

My simulation is using actors and Scala 2.8-Snapshot. In Java JRE 1.5 it runs well - all 40 gears (actors) are working simultaneously. Using Java JRE 1.6 only 3 gears are working simultaneously. I ...
Sirotek asked 18/2, 2010 at 13:0

3

Solved

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 ...
Fathom asked 16/2, 2010 at 14:1

2

Solved

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 Troe...
Peregrinate asked 16/2, 2010 at 17:4

1

Solved

Was trying to compile some code from this SO question and run into this error message cannot find class manifest for element type T. Here is another snippet that shows the behavior: scala> def ...
Seriocomic asked 12/2, 2010 at 14:58

© 2022 - 2024 — McMap. All rights reserved.