From: "Randy W. Sims" Date: 2004-10-09T18:18:12+09:00 Subject: Re: Range behavior (Re: [RCR] New [] Semantics) On 10/9/2004 5:08 AM, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Range behavior (Re: [RCR] New [] Semantics)" > on Sat, 9 Oct 2004 17:49:57 +0900, "Randy W. Sims" writes: > > |The behavior of: > | > |irb(main):002:0> (1..5).include?( 2.5 ) > |=> true > | > |was a complete suprise to me. It goes against the expectations created > |by the first example above. > > The point is whether your expectation is > > * important enough to keep, even after you've been explained > * worthy for the cost of iteration, such that > > (0..1000000000).member?(999999999) > > takes seven minutes. Hmm, I guess I expected Range to be implemented as an ordered set, an array. Thus Range#member? would be a quick binary search... Randy.