From: Xavier Noria Date: 2007-09-21T02:28:25+09:00 Subject: Re: Idiomatic Ruby for Array#extract / Range#length? On Sep 20, 2007, at 6:56 PM, Rick DeNatale wrote: > You lost me, so what's the rational which is the successor to 1/3? OK, the point is that we are not using the everyday order of Q. Our target are Ruby ranges, and I took custom orders and succ on a subset of Q to show a (theoretic) property of Ruby ranges that follows from the fact that they only assume #<=> and #succ. In Ruby we are defining a class[*] class MyReorderedRationalsBetween0and1 attr_reader :q def initialize(q) @q = q end def <=>(p) ... end def succ ... end end such that we have a range r my0 = MyReorderedRationalsBetween0and1.new(0) my1 = MyReorderedRationalsBetween0and1.new(1) r = my0..my1 which is well-defined and infinite. That is what I meant when I said that an enumeration of the rationals in [0, 1] with suitables #<=> and #succ would give an example of infinite range. I demonstrated that is possible in theory, taking a function f that set theory guarantees it exists. Now, I didn't give a computable f you can encode in Ruby, but I am sure there's one. Of course it wouldn't really work in practice because you can't represent all rationals in a real computer. So in the first place there's no way you can go over the rationals in a real computer, no matter whether you have an f or not. I think I could come with a simpler example that had the naturals plus infinity plus perhaps something else technically needed, and use standard orderings and succs for the finite part. -- fxn [*] There's a detail about 1.succ that I won't address to keep it simple.