Sort::Key::Top 0.01
Sponsored Links
Sort::Key::Top 0.01 Ranking & Summary
File size:
0.042 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
831
Date added:
2007-07-18
Publisher:
Salvador Fandiño
Sort::Key::Top 0.01 description
Sort::Key::Top is a Perl module that can select and sort top n elements.
SYNOPSIS
use Sort::Key::Top (nkeytop top);
# select 5 first numbers by absolute value:
@top = nkeytop { abs $_ } 5 => 1, 2, 7, 5, 5, 1, 78, 0, -2, -8, 2;
# ==> @top = (1, 2, 1, 0, -2)
# select 5 first words by lexicographic order:
@a = qw(cat fish bird leon penguin horse rat elephant squirrel dog);
@top = top 5 => @a;
# ==> @top = qw(cat fish bird elephant dog);
The functions available from this module select the top n elements from a list using several common orderings and custom key extraction procedures.
They are all variations around
keytopsort { CALC_KEY($_) } $n => @data;
This function calculates the ordering key for every element in @data using the expression inside the block. Then it selects and orders the $n elements with the lower keys when compared lexicographically.
It is equivalent to the pure Perl expression:
(sort { CALC_KEY($a) cmp CALC_KEY($b) } @data)[0 .. $n-1];
Variations allow to:
- use the own values as the ordering keys
topsort 5 => qw(a b ab t uu g h aa aac);
==> a aa aac ab b
- return the selected values in the original order
top 5 => qw(a b ab t uu g h aa aac);
==> a b ab aa aac
- use a different ordering
For instance comparing the keys as numbers, using the locale configuration or in reverse order:
rnkeytop { length $_ } 3 => qw(a ab aa aac b t uu g h);
==> ab aa aac
rnkeytopsort { length $_ } 3 => qw(a ab aa aac b t uu g h);
==> aac ab aa
A prefix is used to indicate the required ordering:
(no prefix)
lexicographical ascending order
r
lexicographical descending order
l
lexicographical ascending order obeying locale configuration
r
lexicographical descending order obeying locale configuration
n
numerical ascending order
rn
numerical descending order
i
numerical ascending order but converting the keys to integers first
ri
numerical descending order but converting the keys to integers first
u
numerical ascending order but converting the keys to unsigned integers first
ru
numerical descending order but converting the keys to unsigned integers first
The full list of available functions is:
top ltop ntop itop utop rtop rltop rntop ritop rutop
keytop lkeytop nkeytop ikeytop ukeytop rkeytop rlkeytop rnkeytop
rikeytop rukeytop
topsort ltopsort ntopsort itopsort utopsort rtopsort rltopsort
rntopsort ritopsort rutopsort
keytopsort lkeytopsort nkeytopsort ikeytopsort ukeytopsort
rkeytopsort rlkeytopsort rnkeytopsort rikeytopsort rukeytopsort
SYNOPSIS
use Sort::Key::Top (nkeytop top);
# select 5 first numbers by absolute value:
@top = nkeytop { abs $_ } 5 => 1, 2, 7, 5, 5, 1, 78, 0, -2, -8, 2;
# ==> @top = (1, 2, 1, 0, -2)
# select 5 first words by lexicographic order:
@a = qw(cat fish bird leon penguin horse rat elephant squirrel dog);
@top = top 5 => @a;
# ==> @top = qw(cat fish bird elephant dog);
The functions available from this module select the top n elements from a list using several common orderings and custom key extraction procedures.
They are all variations around
keytopsort { CALC_KEY($_) } $n => @data;
This function calculates the ordering key for every element in @data using the expression inside the block. Then it selects and orders the $n elements with the lower keys when compared lexicographically.
It is equivalent to the pure Perl expression:
(sort { CALC_KEY($a) cmp CALC_KEY($b) } @data)[0 .. $n-1];
Variations allow to:
- use the own values as the ordering keys
topsort 5 => qw(a b ab t uu g h aa aac);
==> a aa aac ab b
- return the selected values in the original order
top 5 => qw(a b ab t uu g h aa aac);
==> a b ab aa aac
- use a different ordering
For instance comparing the keys as numbers, using the locale configuration or in reverse order:
rnkeytop { length $_ } 3 => qw(a ab aa aac b t uu g h);
==> ab aa aac
rnkeytopsort { length $_ } 3 => qw(a ab aa aac b t uu g h);
==> aac ab aa
A prefix is used to indicate the required ordering:
(no prefix)
lexicographical ascending order
r
lexicographical descending order
l
lexicographical ascending order obeying locale configuration
r
lexicographical descending order obeying locale configuration
n
numerical ascending order
rn
numerical descending order
i
numerical ascending order but converting the keys to integers first
ri
numerical descending order but converting the keys to integers first
u
numerical ascending order but converting the keys to unsigned integers first
ru
numerical descending order but converting the keys to unsigned integers first
The full list of available functions is:
top ltop ntop itop utop rtop rltop rntop ritop rutop
keytop lkeytop nkeytop ikeytop ukeytop rkeytop rlkeytop rnkeytop
rikeytop rukeytop
topsort ltopsort ntopsort itopsort utopsort rtopsort rltopsort
rntopsort ritopsort rutopsort
keytopsort lkeytopsort nkeytopsort ikeytopsort ukeytopsort
rkeytopsort rlkeytopsort rnkeytopsort rikeytopsort rukeytopsort
Sort::Key::Top 0.01 Screenshot
Sort::Key::Top 0.01 Keywords
Top 0.01
KEY
CALC
ascending order
descending order
Perl module
Keys To
g h
Can Select
top
order
aac
n
ab
5
Sort::Key::Top
Bookmark Sort::Key::Top 0.01
Sort::Key::Top 0.01 Copyright
WareSeeker periodically updates pricing and software information of Sort::Key::Top 0.01 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::Key::Top 0.01 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
order checks online
what is ascending order
law and order
order flowers
ascending order in excel
order of the stick
order flowers online
new world order
in ascending order
ascending order calculator
ordering checks
order my steps
perl modules
order forms
money order
order of operations
ascending order in sql
sql ascending order
Related Software
Sort::Key is the fastest way to sort anything in Perl. Free Download
Sort::Fields is a Perl module that can sort lines containing delimited fields. Free Download
Sort::Half::Maker is a Perl module to create half-sort subs easily. Free Download
NetPacket::LLC is a Perl module to assemble and disassemble IEEE 802.3 LLC protocol packets. Free Download
LSF::Hosts is a Perl module to retrieve information about LSF hosts. Free Download
Sort::Radix is a Perl module with multiple passes distribution sort algorithm. Free Download
Convert::CharMap is a Perl module that can conversion between Unicode Character Maps. Free Download
WWW::NanoRef is a Perl module that uses the API published by nanoref.com to produce shortened URLs. Free Download
Latest Software
Popular Software
Favourite Software