[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Omaha.pm] Evolution or devolution?
Huh. None of those look like a Schwartzian Transform to me...?
http://en.wikipedia.org/wiki/Schwartzian_Transform
I don't have a map sort map anywhere?
j
-----Original Message-----
From: Sean Baker
Sent: Thursday, December 28, 2006 3:32 PM
To: Jay Hannah
Cc: Trey Bianchini
Subject: RE: [Omaha.pm] Evolution or devolution?
There is such a thing as maintainable code. I guess a Schwartzian
Transform isn't all that bad.
Sean Baker
Software Architect
Omni Hotels
(402) 952-6508
pbaker@omnihotels.com
-----Original Message-----
From: omaha-pm-bounces+pbaker=omnihotels.com@pm.org
[mailto:omaha-pm-bounces+pbaker=omnihotels.com@pm.org] On Behalf Of Jay
Hannah
Sent: Thursday, December 28, 2006 3:29 PM
To: omaha-pm@pm.org
Subject: [Omaha.pm] Evolution or devolution?
Here's three code snippets in 3 different chunks of code that do the
same thing... Is this progress? :)
j
First example I found...
my ($common_rate,$cnt);
foreach my $rate (keys %common_rates) {
if ($common_rates{$rate} >= $cnt) {
next if ($rate < $common_rate);
$common_rate = $rate;
$cnt = $common_rates{$rate};
}
}
Second example I found...
my ($highest_frequency) = reverse sort values %ratecount;
@rates = grep { $ratecount{$_} == $highest_frequency } @rates;
my @common = reverse sort @rates;
return $common[0];
Code I just wrote:
print [ sort { $common_rates{$b} <=> $common_rates{$a} } keys
%common_rates ]->[0];
http://cancerweb.ncl.ac.uk/cgi-bin/omd?query=devolution&action=Search+OM
D
_______________________________________________
Omaha-pm mailing list
Omaha-pm@pm.org
http://mail.pm.org/mailman/listinfo/omaha-pm