Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
0answers
18 views

Defining transpose on a collection of irregular collections

I was asked to submit my request for code review on http://stackoverflow.com/questions/10672046/defining-transpose-on-a-collection-of-irregular-collections here. This is a follow-up to the post I ...
2
votes
2answers
99 views

Code review of Pouring water from code chef using Scala

I had posted this question on Stackoverflow and it seems like code review might be a better venue for my query. My question is as follows: I am trying to solve the pouring water problem from codechef ...
1
vote
0answers
35 views

Scala: Josephus problem with Actors

Another stab at the Josephus problem, this time using Actors. N people stand in a circle and every stepth person is eliminated until one is remaining. The way I solve it here is to give each actor a ...
0
votes
0answers
22 views

Josephus problem in Scala without mutable state

The Josephus problem is a game involving a circle of people who take turns to kill themselves (being removed from the circle in the process), with the next person to go being a fixed number of places ...
1
vote
1answer
31 views

Which name should I choose for private abstract functionality with a public proxy?

I have an abstract class implementing some concrete functionality for its child classes: abstract class Function { def eval: Double = some_concrete_functionality_which_calls_fEval def simplify: ...
4
votes
2answers
87 views

Attempting to eliminate var (and imperative style) from my Piece class

I've been cooking with gas since I got Daniel C Sobral's help on my last question. I am now re-reading Odersky's "Programming in Scala, 2nd Edition" (finished my first reading about this time last ...
2
votes
1answer
53 views

Ideal FP/Scala way to vaildate rectangular list

I am learning Scala and FP (Functional Programming), coming from Java, OO and a strong imperative pardigm. I am now trying to implement a small puzzle solving project so I can get some deeper hands on ...
3
votes
1answer
174 views

Pouring Water = My first scala code

This is my first time in CodeReview, I'd hope like something like that existed and voila, a fellow StackExchange site has already been done. I just began to study Scala (coming from Python I had ...
2
votes
1answer
86 views

Help new Scala developer

I am a moderately new Scala developer working mostly by myself, so I don't have anyone to tell me what I'm doing wrong (except that the system mostly does work, so it can't be too awful). I would ...
4
votes
3answers
188 views

Finding the first stream of non-repeating elements in Scala (without recursion or side-effects)

Here are some examples: [1, 2, 3, 4, 5] => [1, 2, 3, 4, 5] [10, 15, 10, 15, 30] => [10, 15] [1, 2, 3, 4, 1, 5, 6, 7] => [1, 2, 3, 4] Here's my best (and deeply ugly) non-recursive, ...
2
votes
1answer
79 views

Scala object-function balance

I am learning Scala, coming from Java background. Here I have written a small prototype proof of concept program that is a part of concept base for a simple upcoming tutorial game. There are two game ...
3
votes
1answer
145 views

Functionally retrieving rows from a database in Scala

Consider the following piece of code: var result = List[Measurement]() val dbResult = conn.createStatement.executeQuery(unsentMeasurements) while(dbResult.next) { result ::= ...
2
votes
1answer
84 views

Scala Direction enum with Enumeration and collection usage

I've just implement direction enum object Direction extends Enumeration { type Direction = Value val Up, Right, Down, Left = Value val pairs = HashSet() ++ List((HashSet() ++ List(Up, Down)), ...
2
votes
1answer
138 views

Simple factory pattern in scala (attempting to restrict use of new)

I am a Scala newbie and attempting to improve my skills. I have decided to be playful about it and work to do a conversion of the spaceinvaders game supplied with the LWJGL. It consists of 10 Java ...
3
votes
2answers
173 views

How to improve this scala code which is checking if two byte arrays are same?

I have a method to compare two byte arrays. The code is java-style, and there are many "if-else"s. def assertArray(b1: Array[Byte], b2: Array[Byte]) { if (b1 == null && b2 == null) return; ...

1 2 3
15 30 50 per page