I\'m studying the source code of the Scala 2.8 collection classes. I have questions about the hierarchy of scala.collection.Traversable. Look at the following declarations:
Option is implicitly convertible to an Iterable - but why does it not just just implement Iterable directly:
I know that to be Traversable, you need only have a f开发者_运维知识库oreach method. Iterable requires an iterator method.
scala> val m = Map(1 -> 2) m: scala.collection.immutable.Map[Int,Int] = Map(1 -> 2) scala>m.map{case (a, b) => (a+ 1, a+2, a+3)}
Clojure has a very nice concept of transient collections. 开发者_高级运维Is there a library providing those for Scala (or F#)?This sounds like a really great concept for language like F#, thanks for a
How can I quickly create a List[开发者_如何学GoInt] that has 1 to 100 in it? I tried List(0 to 100), but it returns List[Range.Inclusive]
In trying to write a开发者_开发知识库n API I\'m struggling with Scala\'s collections in 2.8(.0-beta1).
How to do that without creating any new collections? Is there something bette开发者_运维技巧r than this?
What\'s the recommended way of creating a pre-populated two-dimensional array in Scala? I\'ve got the following code:
This is something I encounter fre开发者_StackOverflow社区quently, but I don\'t know the elegant way of doing. I have a collection of Foo objects. Foo has a method bar() that may return null or a Bar o