| 1 |
Iterator::Util version 0.02 |
| 2 |
=========================== |
| 3 |
|
| 4 |
This module contains many useful utility functions for use with the |
| 5 |
Iterator class (q.v.). The inspiration for many of these functions |
| 6 |
has been Mark Jason Dominus's lectures and recent book (_Higher Order |
| 7 |
Perl_, Morgan Kauffman, 2005). |
| 8 |
|
| 9 |
An "iterator" is an object, represented as a code block that generates |
| 10 |
the "next value" of a sequence, and generally implemented as a |
| 11 |
closure. Iterator.pm provides a class that simplifies creation and |
| 12 |
use of these iterator objects, and provides many general-purpose |
| 13 |
iterator functions. |
| 14 |
|
| 15 |
EXAMPLES |
| 16 |
|
| 17 |
$it = irange (1, 3); |
| 18 |
|
| 19 |
$i = $it->value; # returns 1 |
| 20 |
$i = $it->value; # returns 2 |
| 21 |
$i = $it->value; # returns 3 |
| 22 |
$i = $it->value; # throws an Iterator::X::Exhausted exception. |
| 23 |
|
| 24 |
$another_it = imap {$_ * $_} irange (7, 10); |
| 25 |
|
| 26 |
while ($another_it->isnt_exhausted) |
| 27 |
{ |
| 28 |
print $another_it->value, "\n"; |
| 29 |
} |
| 30 |
# The above prints 49, 64, 81, 100 and throws no exceptions. |
| 31 |
# Another call to $another_it->value would throw an exception. |
| 32 |
|
| 33 |
DEVELOPMENT STATE |
| 34 |
|
| 35 |
This is a brand-new module. It has a decent test suite, but has |
| 36 |
not been extensively field-tested. Therefore, it should be considered |
| 37 |
"beta" software, and used with care. |
| 38 |
|
| 39 |
If you find any bugs, or if any behavior of Iterator surprises you, |
| 40 |
I would be grateful if you could send me an email message about it. |
| 41 |
Thanks. |
| 42 |
|
| 43 |
|
| 44 |
INSTALLATION |
| 45 |
|
| 46 |
To install this module, do the standard Perl module four-step: |
| 47 |
|
| 48 |
perl Makefile.PL or perl Makefile.pl LIB='my/install/path' |
| 49 |
make |
| 50 |
make test |
| 51 |
make install |
| 52 |
|
| 53 |
DEPENDENCIES |
| 54 |
|
| 55 |
This module requires these other modules and libraries: |
| 56 |
|
| 57 |
Iterator |
| 58 |
|
| 59 |
COPYRIGHT AND LICENSE |
| 60 |
|
| 61 |
Eric J. Roode, [email protected] |
| 62 |
|
| 63 |
To avoid my spam filter, please include "Perl", "module", or this |
| 64 |
module's name in the message's subject line, and/or GPG-sign your |
| 65 |
message. |
| 66 |
|
| 67 |
Copyright (c) 2005 by Eric J. Roode. All Rights Reserved. |
| 68 |
This module is free software; you can redistribute it and/or modify it |
| 69 |
under the same terms as Perl itself. |