Skip to content

Instantly share code, notes, and snippets.

@stuhood
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuhood/a1ba6108f557d724d16b to your computer and use it in GitHub Desktop.
Save stuhood/a1ba6108f557d724d16b to your computer and use it in GitHub Desktop.
scala> def inf(i: Long = 0): Stream[Long] = Stream.cons(i, inf(i+1))
inf: (i: Long)Stream[Long]
scala> val iterable: Iterable[Long] = inf()
iterable: Iterable[Long] = Stream(0, ?)
scala> inf().drop(Int.MaxValue).take(10): Iterable[Long]
res3: Iterable[Long] = Stream(2147483647, ?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment