From: "Mark J. Reed" Date: 2003-07-31T01:11:47+09:00 Subject: Re: Set doesn't have [] instance method - and Set#| is inconsistent with Set#& On Wed, Jul 30, 2003 at 04:23:27PM +0900, Brian Candler wrote: > On Wed, Jul 30, 2003 at 11:07:02AM +0900, Mark J. Reed wrote: > > It's not a lookup; it's a membership test. Sets are not Hashes - they're > > Arrays that don't allow duplicate values. > > I disagree - Arrays are ordered, Sets are not. True, which is why s[n] doesn't make sense for numerical indices n, either. I wasn't being precise; I was just trying to make the point that for purposes of my argument and the message to which I was replying, sets are more arraylike than hashlike. They are, of course, actually a third, completely different animal. Sets are unordered collections of individual items. There is no explicit or implicit mapping between these items and any other set of entities. Arrays are also collections of individual items, but the items are ordered; there is therefore an implicit mapping to the items from the set of nonnegative integers. Hashes are unordered collections of (key, value) pairs, which therefore comprise a mapping from the set of keys to the set of values. -Mark