From: Sebastian Hungerecker Date: 2007-09-21T04:14:15+09:00 Subject: Re: Idiomatic Ruby for Array#extract / Range#length? Xavier Noria wrote: > So, in what sense succ is not required? You can have a range of objects that don't have succ. You just can't iterate over that range. You can check whether a given object is inside that range though. See: class Bla attr_accessor :blabb @@blubb=0 def initialize() @blabb=@@blubb @@blubb+=1 end def <=>(other) blabb<=>other.blabb end end arr=Array.new(10) {Bla.new} (arr[2]..arr[5]).include? arr[4] #=> true (arr[2]..arr[5]).include? arr[1] #=> false (arr[2]..arr[5]).include? arr[7] #=> false (arr[2]..arr[5]).each do end # TypeError: can't iterate from Bla -- NP: Shape of Despair - Still-motion Jabber: sepp2k@jabber.org ICQ: 205544826