The idea for LazyCollection is very simple. It takes a functional
approach to the common collection protocol of select:, collect:, and
reject:. By functional, I mean the collection is not changed nor is a new
one created. The blocks are kept around until they are absolutely
needed. I have been wanting this functionality for some time because
it's nice for large collections. If you have a collection in which you are
calling a lot selects, rejects, or collects on, then this will not create
the intermediate collections. It will wait until you ask something of the
collection where it can not delay the answer. This should make these
chained operations must faster on large collections.
This was a lot of fun to program and it's not that big. Take whatever
you want from it!
For examples, see the LazyCollectionTesttest.
To use, simply append lazy to select:, collect:, and reject: selectors.