summaryrefslogblamecommitdiff
path: root/test/files/pos/t927.scala
blob: 534f355045772487c74685be64716120cf1142ea (plain) (tree)
1
2
3
4
5
6
7
8
9

             
                                     
                  
                            

                                              
                                                      
                       
  
 
object Test {

  def sum(stream: Stream[Int]): Int =
    stream match {
      case Stream.Empty => 0
      case Stream.cons(hd, tl) => hd + sum(tl)
    }
  val str: Stream[Int] = List(1,2,3).iterator.toStream
  assert(sum(str) == 6)
  
}