What is the difference between a view and a stream?
In the Scala 2.8 collections framework, what is the difference between view and toStream ? In a view elements are recomputed each time they are accessed. In a stream elements are retained as they are evaluated. For example: val doubled = List(1,2,3,4,5,6,7,8,9,10).view.map(_*2) println(doubled.mkString(" ")) println(doubled.mkString(" ")) will re-evaluate the map for each element twice. Once for the first println, and again for the second. In contrast val doubled = List(1,2,3,4,5,6,7,8,9,10).toStream.map(_*2) println(doubled.mkString(" ")) println(doubled.mkString(" ")) will only double the