From: Stefan Walk Date: 2006-01-15T03:54:55+09:00 Subject: Re: Range#member? Oddity David Vallner wrote: > There's nothing wrong with enumerating ranges, you can well have > intervals of natural numbers or other countably infinite sets. Bounded > intervals of countable or countably infinite sets are finite sets and > may be (not necessarily though) enumerated in order using the successor > operation, which exists if the elements of the interval are > well-ordered. It's not exactly an edge case, and distinguishing between > ranges with finite and infinite element counts Your messages seems to have been truncated here. Also, you're wrong, bounded intervals of countably infinite sets do not have to be finite. Consider [0,1] in the rational numbers. Rational numbers are countable, the range is bounded, but the set is not finite (it is still countably infinite). > Using a string Range is a convenient shortcut, but it's a _hack_. > Nothing more, nothing less. Strings don't have a solid foundation for > use in maths. If you expect strings to behave as numbers, you're wrong, > they're not supposed to, any bugs are your fault, not the fault of the > Ruby core API. Moan and suffer. > > David Vallner Range including Enumerable is a fault of the ruby core API, because (1.0..20) pretends to be enumerable (is_a? returns true, responds_to? :each returns true), but is not. Regards, Stefan (who never had problems with string ranges, only with Range including Enumerable)