Daniel Carrera <dcarrera / math.umd.edu> wrote:
> On Mon, 13 Jan 2003, Bulat Ziganshin wrote:
> 
>> Hello Martin,
>>
>> Sunday, January 12, 2003, 11:48:27 AM, you wrote:
>>
>> MD> class Array
>> MD>   def ssort(&block)
>> MD>     map {{|i| [&block.call(i), i]}\
>> MD>     .sort {|a,b| a[0] <=> b[0]}\
>>
>> just ".sort" will be faster (in most cases :)
> 
> Yes, but it does something different.  '.sort' sorts in ASCIIbetical
> order (so 10 comes before 2) , whereas <=> is a numerical sort.

Not under 1.7.3, at least:

a = [[10, 20], [3, 4], [1, "a"]]
a.sort # => [[1, "a"], [3, 4], [10, 20]]

martin