- or download this
use List::Util 'max';
my @scores = <FH>;
my $high_score = max(@scores);
- or download this
my @scores = $FH; # $FH.lines called automatically in list context
my $high_score= [max] @scores;
- or download this
my @feed <== 1, 2, 3, blah blah blah;
- or download this
# bad - do not use
my Feed $pipeline .= new (... options to make it do what I said above
+...);
my $result= &[max] <== @$pipeline; # ??? threaded on both sides ?
# blah blah blah
$pipeline.add ($item); # every once in a while
- or download this
my @pipeline <== gather {
while $whatever
...
}
}
my $result = [max] @pipeline;
- or download this
sub gen_reduce {
my $usage = 'Usage: gen_reduce("initial" => $val, "compare" => $co
+de_ref)';
...
my $compare = $opt{compare};
my $val = $opt{initial};
# FINALLY start the actual function
- or download this
sub gen_reduce (&compare, ?$initial)
- or download this
my $maxstr = gen_reduce {
return length($_[0]) > length($_[1]);
}
- or download this
my $maxstr = gen_reduce {
return length($^left) > length($^right);
}