Sort::Half::Maker 0.03
Sponsored Links
Sort::Half::Maker 0.03 Ranking & Summary
File size:
0.004 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
807
Date added:
2007-08-08
Publisher:
Adriano R. Ferreira
Sort::Half::Maker 0.03 description
Sort::Half::Maker is a Perl module to create half-sort subs easily.
SYNOPSIS
use Sort::Half::Maker qw(make_halfsort);
$sub = make_halfsort(
start => [ qw(x y z) ],
end => [ qw(a b c) ],
fallback => sub { $_[0] cmp $_[1] },
);
@list = sort $sub qw(a y f h w z b t x);
# qw(x y z f h t w a b)
Before anything, what it a half-sort?
A half-sort is a sort subroutine defined by a starting list, an ending list and an ordinary sort subroutine. Elements in the starting list always go first in comparison to others and keep the original order. Elements in the ending list always go last in comparison to others and keep their original order. The remaining elements are sorted via the given ordinary sort subroutine.
An example, please?
Imagine we want to sort the list of key/value pairs of a hash, such that qw(name version abstract license author) come first and qw(meta-spec) comes last, using case-insensitive comparison in-between. With this module, this is done so:
$sub = make_halfsort(
start => [ qw(name version abstract license author) ],
end => [ qw(meta-spec) ],
fallback => sub { lc $_[0] cmp lc $_[1] }
);
my @pairs = map { ($_, $h{$_}) } sort $sub keys(%h);
Why is it good for?
I dont see many uses for it. I played with the concept while writing a patch to improve META.yml generation by ExtUtils::MakeMaker. There we wanted to dump some keys (like name, version, abstract, license, author) before and then the ones the module author provided as extra information.
FUNCTIONS
make_halfsort
$sub = make_halfsort(start => @start_list,
end => @end_list,
fallback => &sort_sub
);
@sorted = sort $sub @unsorted;
Builds a sort subroutine which can be used with sort. It splits the sorted list into (possibly) three partitions: the elements contained in @start_list, the elements contained in @end_list and the remaining ones. For the elements in @start_list and @end_list, the list order is preserved. For the remaining ones, the given sort sub (or the default) is used.
If fallback is ommited, it defaults to use the sort sub sub ($$) { $_[0] cmp $_[1] }.
The arguments start or end may be ommited as well. But if you omit both, you could have done it without a half-sort.
SYNOPSIS
use Sort::Half::Maker qw(make_halfsort);
$sub = make_halfsort(
start => [ qw(x y z) ],
end => [ qw(a b c) ],
fallback => sub { $_[0] cmp $_[1] },
);
@list = sort $sub qw(a y f h w z b t x);
# qw(x y z f h t w a b)
Before anything, what it a half-sort?
A half-sort is a sort subroutine defined by a starting list, an ending list and an ordinary sort subroutine. Elements in the starting list always go first in comparison to others and keep the original order. Elements in the ending list always go last in comparison to others and keep their original order. The remaining elements are sorted via the given ordinary sort subroutine.
An example, please?
Imagine we want to sort the list of key/value pairs of a hash, such that qw(name version abstract license author) come first and qw(meta-spec) comes last, using case-insensitive comparison in-between. With this module, this is done so:
$sub = make_halfsort(
start => [ qw(name version abstract license author) ],
end => [ qw(meta-spec) ],
fallback => sub { lc $_[0] cmp lc $_[1] }
);
my @pairs = map { ($_, $h{$_}) } sort $sub keys(%h);
Why is it good for?
I dont see many uses for it. I played with the concept while writing a patch to improve META.yml generation by ExtUtils::MakeMaker. There we wanted to dump some keys (like name, version, abstract, license, author) before and then the ones the module author provided as extra information.
FUNCTIONS
make_halfsort
$sub = make_halfsort(start => @start_list,
end => @end_list,
fallback => &sort_sub
);
@sorted = sort $sub @unsorted;
Builds a sort subroutine which can be used with sort. It splits the sorted list into (possibly) three partitions: the elements contained in @start_list, the elements contained in @end_list and the remaining ones. For the elements in @start_list and @end_list, the list order is preserved. For the remaining ones, the given sort sub (or the default) is used.
If fallback is ommited, it defaults to use the sort sub sub ($$) { $_[0] cmp $_[1] }.
The arguments start or end may be ommited as well. But if you omit both, you could have done it without a half-sort.
Sort::Half::Maker 0.03 Screenshot
Sort::Half::Maker 0.03 Keywords
Maker 0.03
To Create
Perl module
list
sub
sort
QW
start
module
Sort::Half::Maker
SortHalfMaker
Sort::Half::Maker 0.03
Libraries
Programming
Bookmark Sort::Half::Maker 0.03
Sort::Half::Maker 0.03 Copyright
WareSeeker periodically updates pricing and software information of Sort::Half::Maker 0.03 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Sort::Half::Maker 0.03 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
List::Maker is a Perl module that can generate more sophisticated lists than just $a..$b. Free Download
Resource::Loader is a Perl module to load different resources depending. Free Download
Sub::Quotelike is a Perl module that allows to define quotelike functions. Free Download
File::Maker is a Perl module that mimics a make by loading a database and calling targets methods. Free Download
App::Manager is a Perl module for installing, managing and uninstalling software packages. Free Download
SQLite::VirtualTable is a Perl module that can create SQLite Virtual Table extensions in Perl. Free Download
Acme::Playmate is a Perl module to consult the playboy playmate directory for playmate information. Free Download
Sort::Radix is a Perl module with multiple passes distribution sort algorithm. Free Download
Latest Software
Popular Software
Favourite Software