[erlang-questions] index for lists and tuples?

Steve Kirsch steve.kirsch@REDACTED
Sat Apr 18 18:18:26 CEST 2009

Thanks for the reference. I agree with the poster who suggested

There are times you really want this (such as in my case where other
solutions would be more clunky) and the suggested lists:pos would be a
natural way to do this. This seems like a surprising omission from an
otherwise pretty complete set of functions.

-----Original Message-----
From: Colm Dougan [mailto:colm.dougan@REDACTED] 

On Fri, Apr 17, 2009 at 6:16 AM, Steve Kirsch <steve.kirsch@REDACTED>
> 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 :



More information about the erlang-questions mailing list