From: "David A. Black" Date: 2004-09-20T23:56:04+09:00 Subject: Re: Array#index block and rdetect Hi -- On Mon, 20 Sep 2004, trans. (T. Onoma) wrote: > On Monday 20 September 2004 09:52 am, Randy W. Sims wrote: > > All enumerable objects don't neccessarilly have a meaningful concept of > > an index. Eg. sets, multisets. Enumerable and Indexable are two > > different things, though Indexable extends Enumerable. > > Main Entry: enu揃mer揃a揃ble > Pronunciation: i-'n(y)端m-r&-b&l, -'n(y)端-m&- > Function: adjective > : DENUMERABLE > > Main Entry: de揃nu揃mer揃a揃ble > Pronunciation: di-'n(y)端-m&-r&-b&l > Function: adjective > : capable of being put into one-to-one correspondence > with the positive integers > > So "index" must mean this corresponding integer. I would argue that sets and > hashes are not technically enumerable, because they're elements can not be > accessed as a _function_ of the index, i.e. one-to-one correspondence. But "being put into one-to-one correspondence" can be done externally, and you can definitely do it with a hash. The question is: how much knowledge of this should the hash itself have? My answer is: none. A hash has no reason to know about or be responsible providing the list of integers against which it can be enumerated. They have no connection to the hash or its elements themselves. David -- David A. Black dblack@wobblini.net