Hi,

In message "Re: Hashes and Enumerable#each_with_index"
    on 03/04/25, Ryan Pavlik <rpav / nwlink.com> writes:

|> No.  Index in each_with_index means offset of the values.  It might be
|> possible to implement a method that you described for arrays, hashes,
|> string, etc.  But it should have different name.
|
|I actually don't really care here... new name (the each_with_key
|suggestion sounds OK to me) or old name, as long as it's there, it'd be
|a little more useful, IMHO.

I'm positive.  But describe what you want more precisely.  The
following behavior OK for you?

  Suppose it is called "each_with_foo":

    * each_with_foo should be available for all built-in classes that
      have obj[x] access.

    * each_with_foo must give (x,y) that obj[y] == x be true always.

Replace "foo" with the right word.  I don't think it's "key", since
Array index is not key after all.

							matz.