XP is just a number | |
PerlMonks |
Re^3: Sort undefby marinersk (Priest) |
on Jun 13, 2017 at 04:20 UTC ( [id://1192654]=note: print w/replies, xml ) | Need Help?? |
The Wikipedia author is being polite. Doing it the 1960s way:
Doing it the 1990s way*:
The author then gently chastises the older approach:
While it is shorter to code, the naive approach here could be much less efficient if the key function (called foo in the example above) is expensive to compute. The explanation on the Wikipedia page is also pretty straightforward. This should probably be considered a core Perl technique within the profession; that is to say, while not knowing about the Schwartzian Transform is no crime, it is a tragedy compelling immediate correction for anyone in the business, should the topic come up. The efficiency gains, when applied to appropriate circumstances, are too great to ignore. Perl programmers should learn not only the technique, but why it is better so they are empowered to better choose when to use it. *We've put people on the Moon in the meantime, so forward progress is not only permissible, but recommended.
In Section
Seekers of Perl Wisdom
|
|