summaryrefslogtreecommitdiff
path: root/test/files/run/stream_length.scala
blob: 2808fbc495569f0ef70fc1edca9aaeb631a3fa05 (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.iterate(1, 99)(_+1).map((x: Int) => walk(depth-1, bias + x))).flatten
    }
  }

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