From: Robert Dober Date: 2007-05-09T23:31:34+09:00 Subject: Re: Implementation of the object.sort method. On 5/9/07, Jorge Domenico Bucaran Romano wrote: > Hi, > > I want a demonstrative implementation of the sort method to see how the > callback (passed block) is handled, specifically the comparison result > <=>. > > For example, in the following code: > > puts [4,5,3,2,1].sort do |a,b| > -1 > end > > puts [4,5,3,2,1].sort do |a,b| > 1 > end > > Both print the array sorted down up. I don't understand how this is > possible so I wanted to see a demonstrative (but factual) implementation > of the sort method to see how this parameters are handled. What's wrong with the code Phrogz posted? > > Regards, Jorge > > -- > Posted via http://www.ruby-forum.com/. > > Robert -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw