Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Better mousetrap (getting top N values from list X)

by Aristotle (Chancellor)
on Feb 02, 2005 at 00:30 UTC ( [id://427106]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
            map { my $x = $code{ $_ }; $_ => sub { my @x = $x->( $n, \@val
    +ues ) } } keys %code
        };
    }
    
  2. or download this
        baseline => sub {
            my ( $n, $list ) = @_;
            return ( sort { $a <=> $b } @$list )[ @$list - $n .. $#$list ]
    +;
        },
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://427106]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-18 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found