[erlang-questions] missing function

Maxim Treskin zerthurd@REDACTED
Tue Dec 23 12:38:41 CET 2008


I can't find standard function which returns position of element in list

num(El, List) ->
    num(El, List, 1).

num(_, [], _) -> {error, not_found};
num(El, [H|T], Acc) ->
    case H of
        El -> Acc;
        _ -> num(El, T, Acc+1)

I think it strange. Can you clarify this point?

Thank you.

Maxim Treskin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081223/e8f1063c/attachment.htm>

More information about the erlang-questions mailing list