Reputation: 92046
Why does the following lead to OutOfMemoryError
?
scala> Stream.tabulate(3, 4)(_ + _)
res0: scala.collection.immutable.Stream[scala.collection.immutable.Stream[Int]] = Stream(Stream(0, ?), ?)
scala> res0.length
The same happens on application of size
and force
methods.
Upvotes: 2
Views: 163
Reputation: 1149
There is a bug in 2.8: "Stream.tabulate creates an infinite stream"
Have a look. http://lampsvn.epfl.ch/trac/scala/ticket/3508
Upvotes: 6