|
Scala example source code file (bug3516.scala)
The Scala bug3516.scala source code
object Test {
def mkIterator = (1 to 5).iterator map (x => { println(x) ; x })
def mkInfinite = Iterator continually { println(1) ; 1 }
def main(args: Array[String]): Unit = {
// Stream is strict in its head so we should see 1 from each of them.
val s1 = mkIterator.toStream
val s2 = mkInfinite.toStream
// back and forth without slipping into nontermination.
println((Stream from 1).toIterator.drop(10).toStream.drop(10).toIterator.next)
()
}
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala bug3516.scala source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.