From: Calamitas Date: 2008-04-04T17:13:20+09:00 Subject: Re: using a range as a key On Fri, Apr 4, 2008 at 3:04 AM, Trans wrote: > It's an interesting idea. What is needed is a Hash that can have key > equality redefined. I seem to recall that 1.9 may have something for > this, so as too allow indifferent key access, and it may work here too > (using === instead of ==, or is it eql?) but I haven't explored it > yet. Interesting idea, and it would work, but it wouldn't work very well as you'll lost most of the advantage of hashing Say we limit ourselves to ranges of integers for now. Then for hashing to work, any integer and any range that integer is in should have the same hash value. This means that all integers a and b, a < b, have the same hash value because a..b includes both, so both must have the same hash value as a..b. This obviously also means that all such ranges must have the same hash value. So although it will still work, the hashing function will be very bad. Peter