Skip to content

Instantly share code, notes, and snippets.

@grzesiak
Created September 29, 2010 20:44
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 grzesiak/603527 to your computer and use it in GitHub Desktop.
Save grzesiak/603527 to your computer and use it in GitHub Desktop.
def toStream[T](generator: => T): Stream[T] = {
def s: Stream[T] = {
val v = generator
if (v == null) Stream.empty else Stream.cons(v, s)
}
s
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment