diff options
author | Karl Berry <karl@freefriends.org> | 2019-03-10 21:56:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-03-10 21:56:14 +0000 |
commit | e0a2a718e89f9700d627f1e6a8eea8f21d2fbeb8 (patch) | |
tree | 39972f65008b0d70f306a5f976494d29411bc41e /Master/tlpkg/tlperl/lib/List | |
parent | b206fdc77d81ed1600949062f08de5690a4bf66f (diff) |
tl19 perl 5.28.1 for Windows, from Siep
git-svn-id: svn://tug.org/texlive/trunk@50322 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/List')
-rw-r--r-- | Master/tlpkg/tlperl/lib/List/Util.pm | 41 | ||||
-rw-r--r-- | Master/tlpkg/tlperl/lib/List/Util/XS.pm | 2 |
2 files changed, 39 insertions, 4 deletions
diff --git a/Master/tlpkg/tlperl/lib/List/Util.pm b/Master/tlpkg/tlperl/lib/List/Util.pm index 23473fc627b..b650d3585ac 100644 --- a/Master/tlpkg/tlperl/lib/List/Util.pm +++ b/Master/tlpkg/tlperl/lib/List/Util.pm @@ -13,9 +13,9 @@ require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw( all any first min max minstr maxstr none notall product reduce sum sum0 shuffle uniq uniqnum uniqstr - pairs unpairs pairkeys pairvalues pairmap pairgrep pairfirst + head tail pairs unpairs pairkeys pairvalues pairmap pairgrep pairfirst ); -our $VERSION = "1.46_02"; +our $VERSION = "1.50"; our $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -116,7 +116,7 @@ C<undef> being returned The above example code blocks also suggest how to use C<reduce> to build a more efficient combined version of one of these basic functions and a C<map> -block. For example, to find the total length of the all the strings in a list, +block. For example, to find the total length of all the strings in a list, we could use $total = sum map { length } @strings; @@ -149,6 +149,9 @@ instead, as it can short-circuit after the first true result. # at least one string has more than 10 characters } +Note: Due to XS issues the block passed may be able to access the outer @_ +directly. This is not intentional and will break under debugger. + =head2 all my $bool = all { BLOCK } @list; @@ -160,6 +163,9 @@ make the C<BLOCK> return true. If any element returns false, then it returns false. If the C<BLOCK> never returns false or the C<@list> was empty then it returns true. +Note: Due to XS issues the block passed may be able to access the outer @_ +directly. This is not intentional and will break under debugger. + =head2 none =head2 notall @@ -174,6 +180,9 @@ Similar to L</any> and L</all>, but with the return sense inverted. C<none> returns true only if no value in the C<@list> causes the C<BLOCK> to return true, and C<notall> returns true only if not all of the values do. +Note: Due to XS issues the block passed may be able to access the outer @_ +directly. This is not intentional and will break under debugger. + =head2 first my $val = first { BLOCK } @list; @@ -544,6 +553,32 @@ entire list of values returned by C<uniqstr> are well-behaved as strings. =cut +=head2 head + + my @values = head $size, @list; + +Returns the first C<$size> elements from C<@list>. If C<$size> is negative, returns +all but the last C<$size> elements from C<@list>. + + @result = head 2, qw( foo bar baz ); + # foo, bar + + @result = head -2, qw( foo bar baz ); + # foo + +=head2 tail + + my @values = tail $size, @list; + +Returns the last C<$size> elements from C<@list>. If C<$size> is negative, returns +all but the first C<$size> elements from C<@list>. + + @result = tail 2, qw( foo bar baz ); + # bar, baz + + @result = tail -2, qw( foo bar baz ); + # baz + =head1 KNOWN BUGS =head2 RT #95409 diff --git a/Master/tlpkg/tlperl/lib/List/Util/XS.pm b/Master/tlpkg/tlperl/lib/List/Util/XS.pm index 783499c35f6..c8c066f8256 100644 --- a/Master/tlpkg/tlperl/lib/List/Util/XS.pm +++ b/Master/tlpkg/tlperl/lib/List/Util/XS.pm @@ -3,7 +3,7 @@ use strict; use warnings; use List::Util; -our $VERSION = "1.46_02"; # FIXUP +our $VERSION = "1.50"; # FIXUP $VERSION = eval $VERSION; # FIXUP 1; |