August 1999 | Return to the Perl Hardware Store | Slide #29 |
An iterator is an object interface to a list
Supports a `next' operation to generate the next item when it is needed
Why?
The list might be enormous
Might take a long time to come up with list elements
You don't know in advance how many you will want
You can pass the object around so it can be used by anyone who needs it
Next | Copyright © 1999 M-J. Dominus |