[erlang-questions] index for lists and tuples?

Colm Dougan <>
Fri Apr 17 15:39:41 CEST 2009


On Fri, Apr 17, 2009 at 6:16 AM, Steve Kirsch <> wrote:
> I am looking for an index function for lists and tuples that returns the
> index of the first element that matches a query term.
>
> For example:
>
> index({a, b, c}, b) would return 2
>
> index([a, b, c], c) would return 3

Steve, there is no such function in the general case but the subject
was discussed in a recent thread :

   http://www.erlang.org/pipermail/erlang-questions/2008-November/040189.html

Colm



More information about the erlang-questions mailing list