The following module was proposed for inclusion in the Module List:
modid: Array::GroupBy
DSLIP: bdpfp
description: Group "equal" elements of an ordered array
userid: SAMB (Sam Brain)
chapterid: 6 (Data_Type_Utilities)
communities:
[email protected]
similar:
List::Util
rationale:
Array::GroupBy exports an iterator "igroup_by()" which, when
called, returns sub-arrays of a given array whose elements are
"equal" as determined by a user-supplied boolean function. The name
is inspired by the SQL "GROUP BY" clause.
The module is most useful when grouping arrays of complex objects,
not just simple 1-dimensional lists.
I use it mostly on SQL-generated 2-D data (returned, e.g., by
DBI::selectall_arrayref), where the array contains multiple levels
of data from joined one-to-many tables, each level requiring its own
"group by" iterator.
It is used by utility functions (which I hope to submit to CPAN as
a module) which build Moose objects from such SQL-generated 2-D
arrays.
In trying to find a place in the namespace, I looked at Iterator::,
but I feel the fact that the implementation uses an iterator is
merely incidental (as in List::MoreUtils::each_array(), for example)
It seemed to fit most naturally in the Array:: namespace.
There is another module called Array::Group, but that module
transforms 1-D lists into 2-D arrays with user-specified row or
column sizes.
enteredby: SAMB (Sam Brain)
enteredon: Mon Jun 18 04:17:15 2012 GMT
The resulting entry would be:
Array::
::GroupBy bdpfp Group "equal" elements of an ordered array SAMB
Thanks for registering,
--
The PAUSE
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=dfb00000_968251aab5e0bfff&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=dfb00000_968251aab5e0bfff&SUBMIT_pause99_add_mod_insertit=1
Peek at the current permissions:
https://pause.perl.org/pause/authenquery?pause99_peek_perms_by=me&pause99_peek_perms_query=Array%3A%3AGroupBy