summaryrefslogtreecommitdiff
path: root/test/files/run/stream_length.scala
blob: 68e9cad5ac3644e34128e84aa876d714e4580d29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
object Test {
  def walk(depth: Int, bias: String): Stream[String] = {
    if (depth == 0)
      Stream(bias)
    else {
      Stream.concat(Stream.range(1, 100).map((x: Int) => walk(depth-1, bias + x)))
    }
  }

  def main(args: Array[String]) {
    println("Length: " + walk(3, "---").length)
  }
}