On Sat, 14 Jan 2006 17:03:59 +0100, Stefan W. [email protected]
Enumerable means that you can map the natural numbers to your set in an
invertable way, and that’s not possible for ranges of real numbers.
Being enumerable means the possibility of a “succ” operation, and
therefore of traversing the whole set with “each” (which may take
infinite time). Being enumerable implies a working each, now try
There’s nothing wrong with enumerating ranges, you can well have
of natural numbers or other countably infinite sets. Bounded intervals
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
The issue with strings is that their ordering does not make them such
well-ordered countably infinite set. Because strings are compared using
textual comparison, as was already noted in this thread, for every two
given strings, there exists an infinite amount of strings between them.
For the sake of completion, strings in fact are a countably infinite
set, but their ordering doesn’t respect any mapping of strings to
Given this, the string successor operation doesn’t even make sense from
the mathemathical point of view. It is in this context defined ad hoc,
it’s usefulness lies in contexts of text processing.
Using a string Range is a convenient shortcut, but it’s a hack.
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.