top | item 31777931

(no title)

mcaravey | 3 years ago

One of my favorite ways to show off enumerables to someone is with an endless list. It really makes someone think when I show an IEnumerable instance that contains every prime number, for example [0].

Obviously you can never evaluate the whole thing, but because of the lazy evaluation you can get enumerators and pull out values all day long. Just don’t .ToList() the darn thing.

[0] https://gist.github.com/arlm/6647474#file-sieveoferatosthene...

discuss

order

No comments yet.