Reduce, fold or scan (Left/Right)?
When should I use reduceLeft, reduceRight, foldLeft, foldRight, scanLeft or scanRight? I want an intuition/overview of their differences – possibly with some simple examples. 3 Answers 3
When should I use reduceLeft, reduceRight, foldLeft, foldRight, scanLeft or scanRight? I want an intuition/overview of their differences – possibly with some simple examples. 3 Answers 3
In scala.collection, there are two very similar objects JavaConversions and JavaConverters. What is the difference between these two objects? Why do they both exist? When do I want to use one vs. the other? 4 Answers 4
It seems that Vector was late to the Scala collections party, and all the influential blog posts had already left. In Java ArrayList is the default collection – I might use LinkedList but only when I’ve thought through an algorithm and care enough to optimise. In Scala should I be using Vector as my default … Read more
In Scala 2.8, there is an object in scala.collection.package.scala: def breakOut[From, T, To](implicit b : CanBuildFrom[Nothing, T, To]) = new CanBuildFrom[From, T, To] { def apply(from: From) = b.apply() ; def apply() = b.apply() } I have been told that this results in: > import scala.collection.breakOut > val map : Map[Int,String] = List(“London”, “Paris”).map(x => … Read more
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more