Acme-IEnumerable
view release on metacpan or search on metacpan
lib/Acme/IEnumerable.pm view on Meta::CPAN
}
sub for_each {
my ($self, $action) = @_;
my $enum = $self->new();
for (my $item = $enum->(); ref $item; $item = $enum->()) {
local $_ = $$item;
$action->($_);
}
}
#####################################################################
#
#####################################################################
# sub select_many { ... }
# sub contains { ... }
# sub sequence_equal { ... }
# sub distinct { ... }
# sub union { ... }
# sub except { ... }
# sub intersect { ... }
# sub default_if_empty { ... }
# sub single_or_default { ... }
# sub concat { ... }
# sub group_join { ... }
# sub join { ... }
# sub empty { ... }
# sub cast { ... }
# sub to_lookup { ...}
# sub to_dictionary { ... }
#####################################################################
#
#####################################################################
# sub distinct_by { ... }
# sub min_by { ... }
# sub max_by { ... }
# sub to_enumerable { ... }
1;
__END__
=head1 NAME
Acme::IEnumerable - Proof-of-concept lazy lists, iterators, generators
=head1 SYNOPSIS
use v5.16;
use Acme::IEnumerable;
my @sorted = Acme::IEnumerable
->from_list(qw/3 2 1/)
->where(sub { $_ < 3 })
->order_by(sub { $_ })
->to_perl;
say join ' ', @sorted;
=head1 DESCRIPTION
Experimental implementation of a iterator/generator protocol and lazy
lists on top of it, with plenty of generic methods inspired by .NET's
IEnumerable interface and corresponding facilities in Ruby, Python,
and Haskell. Mainly for discussion purposes.
=head2 STATIC METHODS
=over 2
=item from_list
Creates new C<Acme::IEnumerable::List> from the supplied list.
=item range($from [, $count])
Creates a new C<Acme::IEnumerable> with $count integers from $from.
=back
=head2 INSTANCE METHODS
=over 2
=item take($count)
Creates new C<Acme::IEnumerable> containing the first $count elements
of the base enumerable.
=item ...
...
=back
=head2 EXPORTS
Nothing.
=head1 AUTHOR / COPYRIGHT / LICENSE
Copyright (c) 2013 Bjoern Hoehrmann <bjoern@hoehrmann.de>.
This module is licensed under the same terms as Perl itself.
=cut
( run in 2.999 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )