Data dodania Pytanie
2017-04-12 15:04 Scala: generic function multiplying Numerics of different types »
I am trying to write a generic weighted average function. I want to relax the requirements on the values and the weights being of the same type. ie, ...
(1) odpowiedzi
2017-04-12 13:04 How to extend the following Java class in Scala: class A<T extends Comparable<? super T>> »
I need to extend a Java class (from a library) of the following type: public class A<T extends Comparable<? super T>> { } I tried to im...
(3) odpowiedzi
2017-04-11 16:04 Can I code in Dotty in German (or at all) in IntelliJ? »
Suspicious that at least a part of this post might be an April Fool's joke, I set about installing Dotty on my Linux laptop and was pleased and surpri...
(1) odpowiedzi
2017-04-11 15:04 Unable to write method in Scala working both for Double and Float »
I'm having trouble to write a method which can be used with Float and Double. The problem is that I need to multiply my generic type parameter A with ...
(3) odpowiedzi
2017-04-11 07:04 How to stack ReaderT and WriterT transformers in scalaz? »
I'm playing with monad transformers in scalaz. I'm trying to stack together a Writer on the top of Reader with the underlying Id monad. For combining ...
(1) odpowiedzi
2017-04-10 17:04 Why doesn't Spark RDD support "flatten" »
Have a look at this snippet [*]: val la = List(Array(2, 3, 5), Array(7, 11, 13)) la.flatten returns res1: List[Int] = List(2, 3, 5, 7, 11, 13) N...
(1) odpowiedzi
2017-04-10 13:04 Why can't Scala Collection fuse transformers? »
I am going to write a high-performance application on Scala and I am trying to figure out best practice for gaining as much performance as possible. D...
(0) odpowiedzi
2017-04-10 08:04 Scala slick query not sorting »
I have this Scala code but it doesn't give the sorted list: def getItemsByCategoryId(catId: Long, start: Int = 0, limit: Option[Int] = None): Future[...
(2) odpowiedzi
2017-04-10 07:04 windows IntelliJ maven dependences error »
Why IntelliJ cannot find these dependences? ...
(1) odpowiedzi
2017-04-09 20:04 How to upcast a monad transformer type? »
Using Cats, is there a better/more idiomatic way to do this? class Foo class Bar extends Foo val eithertBar = EitherT.apply(SomeMonad(Right[Whatever...
(1) odpowiedzi
2017-04-09 10:04 If scala advocate immutability why it adopted actor model with its mutable nature? »
I am new in scala and actor world. This is what I've learned so far: Scala is functional programming (not purely) and people advice not to use muta...
(3) odpowiedzi
2017-04-09 02:04 Using class field in lambda as parameter Scala »
I am trying to create a constructor in which one of the methods could be passed. See my code: class Foo(fooMethod: () => Unit, var x: Int, var y: ...
(1) odpowiedzi
2017-04-08 22:04 Do something when exactly one option is non-empty »
I want to compute something if exactly one of two options is non-empty. Obviously this could be done by a pattern match, but is there some better way?...
(4) odpowiedzi
2017-04-08 13:04 Check if number is prime in O(sqrt(n)) in Scala »
When checking if n is a prime number in Scala, the most common solutions is concise one-liner which can be seen in almost all similar questions on SO ...
(1) odpowiedzi
2017-04-08 13:04 A class imported from a companion not usable as the constructor parameter default value »
Consider following code: object Main extends App { object Project { case class Config(rules: Seq[String] = Seq.empty) } import Project._ ...
(1) odpowiedzi
2017-04-08 10:04 Scala/Spark Ordering on multiple dimensions with reverse on specific one »
I would like to order for exemple an 2d array or RDD like follow : val a = Array((1,1),(1,2),(1,3),(2,1),(2,2),(2,3)) To obtain an ascending sort o...
(1) odpowiedzi
2017-04-07 15:04 Is it possible to run Scala SBT Scoverage without running 'sbt clean' »
It would be great if one can take advantage of sbt incremental compilation and not having to recompile the whole project every time you run the tests,...
(0) odpowiedzi
2017-04-07 10:04 "Immortal" Spark Streaming Job? »
All right, so I've asked a somewhat similar question related to how Spark handles exceptions internally, but the example I had back then wasn't really...
(2) odpowiedzi
2017-04-07 08:04 Sum of n numbers result is wrong in Scala »
I am reading comma-separated numbers from a text file from and performing addition of all numbers in a file - but the sum I'm getting is wrong. Input...
(2) odpowiedzi
2017-04-06 17:04 Why are all invariant generic class positions invariant in type parameter lists in Scala? »
I'm a bit perplexed by the strictness of the typechecker below — it seems that the invariant T position of Inv[T] is also invariant within Varia...
(1) odpowiedzi
2017-04-06 14:04 Combine call-by-name colon operator and space incoherency »
Here is the following problem. When I run the following: object Test { def /:(s: => Unit) = { println("/:") s } } println("A") /: Te...
(2) odpowiedzi
2017-04-06 00:04 What is the Tensorflow Java Api `toGraphDef` equivalent in Python? »
I am using the Tensorflow Java Api to load an already created Tensorflow model into the JVM. I am using this as an example: tensorflow/examples/LabelI...
(1) odpowiedzi
2017-04-05 23:04 Some(null) to Stringtype nullable scala.matcherror »
I have an RDD[(Seq[String], Seq[String])] with some null values in the data. The RDD converted to dataframe looks like this +----------+----------+ ...
(3) odpowiedzi
2017-04-05 11:04 Why does overloading polymorphic methods with different upper bounds not compile in Scala »
Why does the following not compile in Scala: class A class B object X { def f[Q <: A](q: Q): Q = q def f[Q <: B](q: Q): Q = q } with err...
(4) odpowiedzi
2017-04-05 10:04 Get from `Some[A]` to `A` »
Is there any way, to get to the type of A from Some[A]? type X = Some[Int] type Y = ??? // what do I have to write here to get `Int` I can define m...
(2) odpowiedzi
2017-04-04 22:04 Does the shuffle step in a MapReduce program run in parallel with Mapping? »
I was trying to understand a MapReduce program. While doing that, I noticed that the reduce tasks start executing almost immediately after all the map...
(1) odpowiedzi
2017-04-04 21:04 spark programming: best way to organize context imports and others with multiple functions »
It's easy and simple in the toy examples for showing how to program in spark. You just import, create, use and discard, all in one little function. ...
(2) odpowiedzi
2017-04-04 19:04 Using array.exists() in Scala »
I am new to Scala and functional programming. I'm creating a tic-tac-toe game (Day 1 of 'Seven Languages in Seven Weeks' (book)) and I'd like to know ...
(2) odpowiedzi
2017-04-04 18:04 Writing SBT variable to resource »
What would be the easiest way of resolving some variable in SBT and storing it to resource file, so that it would be available in the runtime? More s...
(2) odpowiedzi
2017-04-03 22:04 Two parameter functions in type class instances of higher kinded types in Scala, how to translate this simple Haskell code to Scala? »
The following Haskell code: main = putStrLn $ "bla " ++ (toStr (A 1) (A 2)) --main2 = putStrLn $ "bla " ++ (toStr (A 1) (A "String")) -- does not com...
(1) odpowiedzi
2017-04-03 17:04 Curry and closures in Scala »
I am preparing a presentation on Scala and functional programming and I am not sure about two notions. I use a function introduced earlier during the...
(2) odpowiedzi
2017-04-03 01:04 scala BufferedSource Position »
I have 2 questions about the Scala class BufferedSource. How can I query the current reading position ? I tried it with pos : object testapp extend...
(1) odpowiedzi
2017-04-02 22:04 sbt deprecation warning <<= replaced with := results in no main class found »
When using sbt 0.13.13. I could observe that when using := no main class is found (but no deprecation warning is shown), and for <<= I get the w...
(1) odpowiedzi
2017-04-02 19:04 Which is better Scala style? »
Although I know this might be purely preference based, I have a question about style. Given the code below: map { updateWriteResult => logg...
(1) odpowiedzi
2017-04-02 18:04 Scala JDBC Connection to Cloudera VM mysql »
how to connect to mysql based on cloudera quickstat vm from scala? I can connect to vm using ssh cloudera@172.16.206.142 and able to launch ...
(0) odpowiedzi