Brian,
I'd argue that it is not a bug, as there is no unique
isomorphie from strings to integers.
I have to disagree.
ruby -v -e "p(('1'..'10').to_a)"
ruby 1.8.2 (2004-12-25) [i386-mswin32]
["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
This shows a clear and unique mapping of the range '1'..'10' into a
set of strings.
- Warren Brown
but where do '01', '001', and '0001' go? they too, are in the set of strings.
regards.
-a
···
On Wed, 23 Nov 2005, Warren Brown wrote:
Brian,
I'd argue that it is not a bug, as there is no unique
isomorphie from strings to integers.
I have to disagree.
ruby -v -e "p(('1'..'10').to_a)"
ruby 1.8.2 (2004-12-25) [i386-mswin32]
["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
This shows a clear and unique mapping of the range '1'..'10' into a
set of strings.
--
ara [dot] t [dot] howard [at] noaa [dot] gov
all happiness comes from the desire for others to be happy. all misery
comes from the desire for oneself to be happy.
-- bodhicaryavatara
===============================================================================
Hi,
I'd argue that it is not a bug, as there is no unique
isomorphie from strings to integers.
I have to disagree.
For your information, member? used to iterate over items to check
membership. But since confusion between include? and member?, they
were merged. The point is Ranges are used both for ranges and
intervals. Sometimes users want it to behave like a range surrounded
by begin/end values. Sometimes they want it to behave like a set of
values, that #each produces.
I'd like to care this issue, but I haven't know the right way to solve
it yet. Perhaps we should provide both membership method, with right
names for each. Any ideas?
matz.
···
In message "Re: [BUG] string range membership" on Wed, 23 Nov 2005 23:57:41 +0900, "Warren Brown" <warrenbrown@aquire.com> writes:
It is not unique as
ruby -e "p %w(1 10 11 100 101).map { | b | b.to_i(2) }"
[1, 2, 3, 4, 5]
is another mapping of strings to integers that is equally valid (and
would not contain '5').
Brian
···
On 23/11/05, Warren Brown <warrenbrown@aquire.com> wrote:
Brian,
> I'd argue that it is not a bug, as there is no unique
> isomorphie from strings to integers.
I have to disagree.
>ruby -v -e "p(('1'..'10').to_a)"
ruby 1.8.2 (2004-12-25) [i386-mswin32]
["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
This shows a clear and unique mapping of the range '1'..'10' into a
set of strings.
- Warren Brown
--
http://ruby.brian-schroeder.de/
Stringed instrument chords: http://chordlist.brian-schroeder.de/