Skip Menu |

This queue is for tickets about the List-MoreUtils CPAN distribution.

Report information
The Basics
Id: 77567
Status: new
Priority: 0/
Queue: List-MoreUtils

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: part_implicitly
Given: @list = part_implicitly { $_->[0] } ( [qw<A 1 2 3>], [qw<A 4 5 6>], [qw<B 1 2 3>], [qw<A 7 8 9>], ); Then @list should be: ( [ [qw<A 1 2 3>], [qw<A 4 5 6>], ], [ [qw<B 1 2 3>], ], [ [qw<A 7 8 9>], ], ); That is, "part_implicitly" partitions the list like "part" does, but rather than the block returning a number indicating the partition, it returns a value which "part_implicitly" remembers. When the value changes from the last execution, then a new partition is started. An example of using "part" to perform this task can be seen here: http://www.perlmonks.org/?node_id=973569 This block: part { state $part = 0; state $last = undef; $part++ if defined $last && $last ne $_->[0]; $last = $_->[0]; $part } Could be replaced with this: part_implicitly { $_->[0] }