Name : perl-Perl6-GatherTake
| |
Version : 0.0.3
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 7.38
| Date : 2024-08-05 19:55:35
|
Group : Development/Libraries/Perl
| Source RPM : perl-Perl6-GatherTake-0.0.3-7.38.src.rpm
|
Size : 0.02 MB
| |
Packager : (none)
| |
Summary : Perl 6 like C< gather { take() }> for Perl 5
|
Description :
Perl6::GatherTake implements an API for producing partial computation results on the fly, storing them in a lazy list.
A word of warning: This module tries to explore some language concepts. It is *not suitable for any productive work*.
A \'gather { ... };\' block returns a reference to a (tied) array. Each call to \'take\' inside the block pushes its arguments to that array. The block is only run as needed to produce results (but see \"BUGS AND LIMITATIONS\" below), which means that you can put infinite loops inside the \'gather\' block as long as it calls \'take\' on a regular basis.
Instead of this common construct:
my AATTresults; for (AATTdata){ if ($result =~ m/super regex/){ push AATTresults, $result; } }
You can now write
my $results = gather { for (AATTdata){ if ($result =~ m/super regex/){ take $result; } } };
It has the nice side effect that the computations are only executed as the array elements are accessed, so if the end of the array is never used you can save much time here.
Nested \'gather { take };\' blocks are supported, a \'take\' always supplies data to the innermost \'gather\' block.
Note that if a \'gather\' block is an infinite loop, you\'re responsible for not accessing all elements. If you do something stupid like iterating over all items, joining them or copying the array (\'my AATTother = AATT$array_ref\') you have an infinite loop (until you run out of memory).
Assigning to an array element triggers evaluation until the index of the changed item is reached.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-P/openSUSE_Tumbleweed/noarch |