From: Xavier Noria Date: 2007-09-21T08:37:40+09:00 Subject: Re: Idiomatic Ruby for Array#extract / Range#length? Right, I've got an infinite closed Range with standard Ruby: class ZSquared include Comparable attr_reader :n, :m def initialize(n, m) @n, @m = n, m end def succ self.class.new(n+1, m) end def <=>(zs) self.m <=> zs.m end end a = ZSquared.new(0, 0) b = ZSquared.new(0, 1) puts a < b # true length = 0 (a .. b).each do |c| length += 1 puts length end # be prepared to send Ctrl-C I am very sorry for the direction this thread took, I am used to formal stuff and used to discuss within its limits with no further interpretations. I knew this was possible but the first example that came to my head was math-based and it was not my intention to get into proofs and stuff which may not be clear to all people in the list. I guess the claim that well-defined infinite Ranges in Ruby are implementable is now clear. -- fxn