Erlang lists:index_of/2 function?

Viewed 16215

I'm looking for an Erlang library function that will return the index of a particular element in a list.

So, if

X = [10,30,50,70]
lists:index_of(30, X)

would return 1, etc., just like java.util.List's indexOf() method.

Does such a method exist in the Erlang standard lib? I tried looking in the lists module but no luck. Or should I write it myself?

6 Answers
Related