From: matz@... (Yukihiro Matsumoto) Date: 2001-05-16T15:54:38+09:00 Subject: [ruby-talk:15247] Re: Pluggable sorting - How would you do it? Hi, In message "[ruby-talk:15234] Pluggable sorting - How would you do it?" on 01/05/16, "Hal E. Fulton" writes: |Passing a block to "sort" is neat, but it's a little more |intrusive than I have in mind. | |I thought about a Proc object or something... but I ended |up doing it this way (see code below). | |It works. But I'm sure many of you have better ideas. | |How would *you* do it? GOTO Kentaro once proposed something like this. a = x.sort_by{|x| x.str} b = x.sort_by{|x| x.int} c = x.sort_by{|x| x.chr} It implements Schwartzian transformation inside. I like this idea, but am not yet sure "sort_by" is a proper name for the behavior. matz.