Iterator::SimpleSimple iterator and utilities | |
Download |
Iterator::Simple Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Rintaro Ishizaki
- Publisher web site:
- http://search.cpan.org/~rintaro/
Iterator::Simple Tags
Iterator::Simple Description
Simple iterator and utilities Iterator::Simple is a Perl module that offers general-purpose iterator utilities.Rather simple, but powerful and fast iterator.SYNOPSIS use Iterator::Simple; sub foo { my $max = shift; my $i = 0; iterator { return if $i > $max; $i++; } } my $iterator = foo(20); # yields 0,1,2, ..., 19, 20; $iterator = imap { $_ + 2 } $iterator; # yields 2,3,4,5, ... ,20,21,22 $iterator = igrep { $_ % 2 } $iterator; # yields 3,5,7,9, ... ,17,19,21 # iterable object $iterator = iter(); # iterator from array ref $iterator = iter(IO::File->new($filename)); # iterator from GLOB # filters $iterator = ichain($itr1, $itr2); # chain iterators; $iterator = izip($itr1, $itr2); # zip iterators; $iterator = ienumerate $iterator; # add index; # general filter $iterator = ifilter $iterator, sub { return $_ if /^A/; return; } # how to iterate while(defined($_ = $iterator->())) { print; } while(defined($_ = $iterator->next)) { print; } while() { print; } Requirements: · Perl
Iterator::Simple Related Software