From: "ara.t.howard" Date: 2007-10-12T12:49:08+09:00 Subject: Re: range max On Oct 11, 2007, at 9:11 PM, Marek Kasperkiewicz wrote: > thanks Morton, > I thought ruby supposed to be better than Perl and Python combined, > but > I can see that's not the case yet. cfp:~ > cat a.rb class Lang < String class ::NilClass def succ() Lang('perl') end end def succ Lang( case self when /perl/i then 'python' when /python/i then 'ruby' else super end ) end def <=> other case other when /ruby/i then match('ruby') ? 0 : -1 else super end end end def Lang(*a, &b) Lang.new(*a, &b) end language = nil list = [] and 3.times{ list << list.last.succ } p list p list.max, list.reverse.max, list.sort_by{ rand }.max cfp:~ > ruby a.rb ["perl", "python", "ruby"] "ruby" "ruby" "ruby" a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama