[system] / trunk / pg / macros / PGbasicmacros.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/PGbasicmacros.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2142 Revision 2143
1689 lex_sort(@list); # outputs list in lexigraphic (alphabetical) order 1689 lex_sort(@list); # outputs list in lexigraphic (alphabetical) order
1690 num_sort(@list); # outputs list in numerical order 1690 num_sort(@list); # outputs list in numerical order
1691 uniq( @list); # outputs a list with no duplicates. Order is unspecified. 1691 uniq( @list); # outputs a list with no duplicates. Order is unspecified.
1692 1692
1693 PGsort( \&sort_subroutine, @list); 1693 PGsort( \&sort_subroutine, @list);
1694 # &sort_subroutine defines order. It's output must be -1,0 or 1. 1694 # &sort_subroutine defines order. It's output must be 1 or 0 (true or false)
1695 1695
1696=cut 1696=cut
1697 1697
1698# uniq gives unique elements of a list: 1698# uniq gives unique elements of a list:
1699 sub uniq { 1699 sub uniq {
1705 my @out = keys %temp; # sort is causing trouble with Safe.?? 1705 my @out = keys %temp; # sort is causing trouble with Safe.??
1706 @out; 1706 @out;
1707} 1707}
1708 1708
1709sub lex_sort { 1709sub lex_sort {
1710 PGsort sub {$_[0] cmp $_[1]}, @_; 1710 PGsort sub {$_[0] lt $_[1]}, @_;
1711} 1711}
1712sub num_sort { 1712sub num_sort {
1713 PGsort sub {$_[0] <=> $_[1]}, @_; 1713 PGsort sub {$_[0] < $_[1]}, @_;
1714} 1714}
1715 1715
1716 1716
1717=head2 Macros for handling tables 1717=head2 Macros for handling tables
1718 1718

Legend:
Removed from v.2142  
changed lines
  Added in v.2143

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9