Somehow I prefer the Ruby solution to add another method to do the unary variant. Compare<p><pre><code> ["A","b","C"].sort {|a, b| a.downcase <=> b.downcase }
</code></pre>
to<p><pre><code> ["A","b","C"].sort_by {|k| k.downcase }
</code></pre>
(or equivalently)<p><pre><code> ["A","b","C"].sort_by &:downcase</code></pre>
Great stuff, nevertheless the following is a surely a regression:<p><i>> Note that in Perl 6, cmp is smart enough to compare strings with string semantics and numbers with number semantics, so producing numbers in the transformation code generally does what you want.</i><p>Perl 5 had a clear distinction between "cmp" (string comparison) and "<=>" (numeric comparison). Trying to work out the data type, and thus the comparison approach, from the actual data itself, is surely going to create subtle bugs, that don't appear in testing, but do appear with live data.
One thing this article does not cover is that, even if a comparison function doesn't do anything slow, there is still the fact that it still has to do a Perl function call O(n log n) times. At least in the equivalent with Python, I think it is advised to use the key function rather than comparison funtion for this reason, for speed. Though I guess a key function needs to take more space if it is to memoize.
So, it's a feature that has been available in every high-order language since forever, except with more line noise. Typical Perl!<p><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" rel="nofollow">http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec...</a>
While it appears that Perl 6 has many impressive features, I'm much more interested in practical matters such as: module versioning, installation, & removal; the state of MoarVM; and the state of the tutorial book.