70 lines
2.0 KiB
Plaintext
70 lines
2.0 KiB
Plaintext
Iterator::Util version 0.02
|
|
===========================
|
|
|
|
This module contains many useful utility functions for use with the
|
|
Iterator class (q.v.). The inspiration for many of these functions
|
|
has been Mark Jason Dominus's lectures and recent book (_Higher Order
|
|
Perl_, Morgan Kauffman, 2005).
|
|
|
|
An "iterator" is an object, represented as a code block that generates
|
|
the "next value" of a sequence, and generally implemented as a
|
|
closure. Iterator.pm provides a class that simplifies creation and
|
|
use of these iterator objects, and provides many general-purpose
|
|
iterator functions.
|
|
|
|
EXAMPLES
|
|
|
|
$it = irange (1, 3);
|
|
|
|
$i = $it->value; # returns 1
|
|
$i = $it->value; # returns 2
|
|
$i = $it->value; # returns 3
|
|
$i = $it->value; # throws an Iterator::X::Exhausted exception.
|
|
|
|
$another_it = imap {$_ * $_} irange (7, 10);
|
|
|
|
while ($another_it->isnt_exhausted)
|
|
{
|
|
print $another_it->value, "\n";
|
|
}
|
|
# The above prints 49, 64, 81, 100 and throws no exceptions.
|
|
# Another call to $another_it->value would throw an exception.
|
|
|
|
DEVELOPMENT STATE
|
|
|
|
This is a brand-new module. It has a decent test suite, but has
|
|
not been extensively field-tested. Therefore, it should be considered
|
|
"beta" software, and used with care.
|
|
|
|
If you find any bugs, or if any behavior of Iterator surprises you,
|
|
I would be grateful if you could send me an email message about it.
|
|
Thanks.
|
|
|
|
|
|
INSTALLATION
|
|
|
|
To install this module, do the standard Perl module four-step:
|
|
|
|
perl Makefile.PL or perl Makefile.pl LIB='my/install/path'
|
|
make
|
|
make test
|
|
make install
|
|
|
|
DEPENDENCIES
|
|
|
|
This module requires these other modules and libraries:
|
|
|
|
Iterator
|
|
|
|
COPYRIGHT AND LICENSE
|
|
|
|
Eric J. Roode, roode@cpan.org
|
|
|
|
To avoid my spam filter, please include "Perl", "module", or this
|
|
module's name in the message's subject line, and/or GPG-sign your
|
|
message.
|
|
|
|
Copyright (c) 2005 by Eric J. Roode. All Rights Reserved.
|
|
This module is free software; you can redistribute it and/or modify it
|
|
under the same terms as Perl itself.
|