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.
6
votes
0answers
96 views
+50
Attempt to port Free Applicative to scala
I'm trying to port Edward Kmett's free package (in particular, Free Applicative) to scala. I was able to get this far. I'm particularly having problem with implementing the ap function for the Ap ...
0
votes
1answer
28 views
Need help figuring out the performance bottle neck
I'm working on my scala chops and implemented a small graph Api to track vertices and edges added to graph. I have basic GraphLike Trait, and have an Undirected Graph class ( UnDiGraph) and a Directed ...
1
vote
2answers
40 views
Recursively print in scala
I have just picked up Scala like 2 hours ago, and I am thinking of printing a series like 1 to 10 but in a recursive fashion. I do not understand what is wrong with this:
def printSeries(x:Int):Int = ...
3
votes
1answer
81 views
Basic (Logical Only) Sudoku Solver
I'm (very) new to Scala, and decided I'd try to get a handle on some of the syntax and general language constructs. This currently doesn't implement any backtracking and will only solve things if ...
3
votes
1answer
54 views
How idiomatic is this Scala 36 Cube Solver
I've written a short program to find solutions to the 36 Cube puzzle. http://en.wikipedia.org/wiki/36_cube
I'm trying to break away from my normal Java / imperative style, and would like some ...
1
vote
0answers
55 views
How to configure JMS Component in akka-camel
I'm trying to write JMS Consumer using Akka-Camel.
For now, I'm using FFMQ as JMS server. I want to listen on JMS queue myqueue.
Creating JMS consumer actor is quite straightforward:
import ...
2
votes
3answers
156 views
Scala inspired classes in Python?
I have to define a lot of values for a Python library, each of which will represent a statistical distribution (like the Normal distribution or Uniform distribution). They will contain describing ...
3
votes
0answers
71 views
Scala Play Controller - Refactoring out Duplication for Restful Web Services
I'm new to scala and I'm noticing I have some repeating code in my controllers.
I'm wondering if anyone can give some hints for traits and parameterization for eliminating duplicate code for basic ...
4
votes
2answers
98 views
Merge sort in scala
I've implemented merge sort in scala:
object Lunch {
def doMergeSortExample() = {
val values:Array[Int] = List(5,11,8,4,2).toArray
sort(values)
printArray(values)
}
def ...
2
votes
0answers
66 views
Is this Scala/Akka idiomatic and correct for Akka 2.1?
I'm wondering if there is anything i'm overlooking in the code below. I've taken the Pi calculation example, simplified it and converted it to Akka 2.1.
More specifically, i use the ask pattern to ...
0
votes
0answers
39 views
Type-safe user preferences in scala
I was thinking about a solution to store preferences and access to them in a most natural way.
I came up with the solution below.
My questions are: what do you think about the solution?
Can it be ...
1
vote
2answers
118 views
Option type in C# and implicit conversions
Good morning everyone,
I have decided to create a simple Option type for C#. I have essentially based it on the
Scala's Option.
It was mostly a fun exercise, but it might come in handy at work or ...
0
votes
0answers
43 views
Testing scala code which depends on objects
I am writing a small oauth2 library for Play! 2.1 scala. As I am still learning I got stuck trying to TDD and ended up writing the code first, then refactoring for testability. By testability I mean ...
4
votes
3answers
168 views
A scala implementation of java trim method
I'm a scala beginner and looking at the trim() method of the java api I noticed side effects, so I attempted to implement a functional version in scala.
Here is the java version :
public String ...
4
votes
1answer
56 views
Terser syntax for first-class functions needing a context bound
I have the following function that looks up a mathematical operation that can be applied to a Numeric sequence based on a String
def getAction[T : Fractional]( op : String ) : Seq[T] => String =
...