Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Good point. For example Collection2.filter() (as well as the other methods from that class) pretty much implements lazy evaluation: the result "looks like" an ordinary Collection, but the order of execution might be non-intuitive (or at least non-obvious). Also, there is yield in Python (and a similar feature in C#, which I don't remembe the name of) which is even closer to supporting lazy evaluation than a normal Iterator. Commented Sep 7, 2012 at 7:04
  • @JoachimSauer in C# its yield return, or of course you can use the prebuild linq oprerators, about half of which are lazy Commented Sep 7, 2012 at 7:08
  • +1: For mentioning iterators in an imperative / object-oriented language. I used a similar solution for implementing streams and stream functions in Java. Using iterators I could have functions like take(n), dropWhile() on an input stream of unknown length. Commented Sep 7, 2012 at 10:11