Skip to content

Instantly share code, notes, and snippets.

@dacr
Created July 13, 2014 16:51
Show Gist options
  • Save dacr/2ca6f45dee608f993760 to your computer and use it in GitHub Desktop.
Save dacr/2ca6f45dee608f993760 to your computer and use it in GitHub Desktop.
scala> def f(x:Int) = {println(x); x+1}
f: (x: Int)Int
scala> val bad = Stream(f(1), f(2), f(3), f(4))
1
2
3
4
bad: scala.collection.immutable.Stream[Int] = Stream(2, ?)
scala> val good=f(1)#::f(2)#::f(3)#::f(4)#::Stream.empty
1
good: scala.collection.immutable.Stream[Int] = Stream(2, ?)
scala>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment