summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Tisue <seth@tisue.net>2016-10-31 09:09:30 -0400
committerGitHub <noreply@github.com>2016-10-31 09:09:30 -0400
commit44e3f3b6ac666e03b05a3904a51f5c498c30fc1a (patch)
treef91fdb279f11a9f60863559cf74aec70770d624a
parent066637781d42d8c512abaf7496e679e0e9f250e6 (diff)
parent1583fbb6b94d0c9d30c1b1646ecebd1249e6389c (diff)
downloadscala-44e3f3b6ac666e03b05a3904a51f5c498c30fc1a.tar.gz
scala-44e3f3b6ac666e03b05a3904a51f5c498c30fc1a.tar.bz2
scala-44e3f3b6ac666e03b05a3904a51f5c498c30fc1a.zip
Merge pull request #5373 from TimWSpence/2.12.x
SI-9909: corrected stream example so it does not give forward reference
-rw-r--r--src/library/scala/collection/immutable/Stream.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala
index db19df315f..3d4e32971c 100644
--- a/src/library/scala/collection/immutable/Stream.scala
+++ b/src/library/scala/collection/immutable/Stream.scala
@@ -23,7 +23,7 @@ import scala.language.implicitConversions
* import scala.math.BigInt
* object Main extends App {
*
- * val fibs: Stream[BigInt] = BigInt(0) #:: BigInt(1) #:: fibs.zip(fibs.tail).map { n => n._1 + n._2 }
+ * lazy val fibs: Stream[BigInt] = BigInt(0) #:: BigInt(1) #:: fibs.zip(fibs.tail).map { n => n._1 + n._2 }
*
* fibs take 5 foreach println
* }
@@ -46,7 +46,7 @@ import scala.language.implicitConversions
* import scala.math.BigInt
* object Main extends App {
*
- * val fibs: Stream[BigInt] = BigInt(0) #:: BigInt(1) #:: fibs.zip(
+ * lazy val fibs: Stream[BigInt] = BigInt(0) #:: BigInt(1) #:: fibs.zip(
* fibs.tail).map(n => {
* println("Adding %d and %d".format(n._1, n._2))
* n._1 + n._2
@@ -162,7 +162,7 @@ import scala.language.implicitConversions
* // The first time we try to access the tail we're going to need more
* // information which will require us to recurse, which will require us to
* // recurse, which...
- * val sov: Stream[Vector[Int]] = Vector(0) #:: sov.zip(sov.tail).map { n => n._1 ++ n._2 }
+ * lazy val sov: Stream[Vector[Int]] = Vector(0) #:: sov.zip(sov.tail).map { n => n._1 ++ n._2 }
* }}}
*
* The definition of `fibs` above creates a larger number of objects than