In Scala, is there a way to get the currently evaluated items in a Stream?

Posted by abhin4v on Stack Overflow See other posts from Stack Overflow or by abhin4v
Published on 2010-05-14T05:20:02Z Indexed on 2010/05/14 5:24 UTC
Read the original article Hit count: 177

Filed under:
|
|

In Scala, is there a way to get the currently evaluated items in a Stream? For example in the Stream

val s: Stream[Int] = Stream.cons(1, Stream.cons(2, Stream.cons(3, s.map(_+1))))

the method should return only List(1,2,3).

© Stack Overflow or respective owner

Related posts about scala

Related posts about stream