KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
When I evaluate a for in Scala, I get an immutable IndexedSeq (a collection with array-like performance characteristics, such as efficient random access): scala> val s = for (i <- 0 to 9) yield math.random + i s: scala.collection.immutable.IndexedSeq[Double] = Vector(0.6127056766832756, 1.7137598183155291, ... Does a for with a yield always return an IndexedSeq , or can it also return some other type of collection class (a LinearSeq , for example)? If it can also return something else, then what determines the return type, and how can I influence it? I'm using Scala 2.8.0.RC3.
Tags (comma-separated)
Save Edits
Cancel