I am trying to create an endless stream of lines from readLine calls:
import java.io.{BufferedReader, InputStreamReader} val in = new BufferedReader(new InputStreamReader(System in)) val input: Stream[String] = Stream.cons(in readLine, input)
But it looks like the readLine call isn't called lazily. Immediately after entering this code, readLine expects input, then Stream becomes an endless list of the same input. Is it possible to do what I mean?
Ukonu
source share