Linked Questions

17 votes
1 answer
13k views

I am getting an error here: val a: Int = 1 val i: Int with Object = a How can I convert this 1 to an integer object in scala? My purpose is to pass it to an Array[Int with Object]. It currently ...
Mikaël Mayer's user avatar
6 votes
1 answer
1k views

I need to write a function that takes a Tuple of String of any size, call trims on each element and returns a new tuple. I am kind of stuck at this point below and the code is already not type safe. ...
Mansur Ashraf's user avatar
1 vote
3 answers
6k views

Here is my code scala> s res6: String = 2005-05-06 14:58:56 192 45.14.5.238 200 TCP_NC_MISS 1123 496 GET http c4.maxserving.com /gen.js ?site=5835&area=side_ros&group=sidebar&PageID=...
daydreamer's user avatar
  • 92.9k
6 votes
4 answers
1k views

scala> val a = List(1,2) a: List[Int] = List(1, 2) scala> val b = List(3,4) b: List[Int] = List(3, 4) scala> val c = List(5,6) c: List[Int] = List(5, 6) scala> val d = List(7,8) d: List[...
fracca's user avatar
  • 2,437
4 votes
3 answers
963 views

I want to define a function that is parameterized by a generic Product type, but which can work out the Product's arity. Here's an example snippet. I'd like to do the arity check when f(…) is invoked, ...
DamonJW's user avatar
  • 3,742
1 vote
2 answers
591 views

I'm parsing a CSV file without new line signs: "line1field1", "line1field2", "line1field3", "line2field1", "line2field2", "line2field3", "line3field1", "line3field2", "line3field3" Is it possible to ...
Piotr Reszke's user avatar
  • 1,616
0 votes
1 answer
445 views

I'm trying to write a boilerplate function that can take a pair of generic case class objects and perform some operations on their set of vals and then return a new instance of the case class. On a ...
Rich's user avatar
  • 2,905
0 votes
1 answer
535 views

I have 8 fields(field1,field2,...,field8) in a flatMap and I would like to create a map object in runtime. I would like to create a map with dynamic key and value elements. For eg. I have key ...
santhosh's user avatar
  • 1,902
2 votes
1 answer
479 views

I am using Jython execute the python code part (a python module with utility functions from existing codebase) that returns a list of tuples, but what I get in scala is a simple flattened list. Any ...
4rk's user avatar
  • 375
-2 votes
1 answer
498 views

I want to create a tuple of size n, where n is an arbitrary integer (that is less than or equal to maximum tuple size). For example, with below data val n = 3 //or 4 or 4 etc ; val y = 15 val z = 10 ...
mike 's user avatar
  • 35
0 votes
3 answers
304 views

Given: scala> val ss = "hello_world".split("_") ss: Array[String] = Array(hello, world) How to turn ss into a tuple (hello, world) with a function of Array (on ss)? I'm thinking about a function ...
Jacek Laskowski's user avatar
3 votes
1 answer
166 views

I have a list of objects, which contain a list of objects of a same type. E.g. List[CustomObject(objName, List[CustomObject])] Currently, I have a program that combines these CustomObjects into a ...
Chris's user avatar
  • 807