Forum: Ruby alternative to Array#index?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5e8fd591aeccbffd6fc93c171ac4fa43?d=identicon&s=25 Aaron Smith (warhero)
on 2007-06-26 01:06
is there an alternative to Array#index? Faster version maybe?
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (regularfry)
on 2007-06-26 09:17
(Received via mailing list)
Aaron Smith wrote:
> is there an alternative to Array#index? Faster version maybe?
>
Change the problem so that you're reading from a hash?  Maintain an
index hash alongside the array?  Keep the array sorted somehow?  It
depends on the problem you're trying to solve, really...
This topic is locked and can not be replied to.