[erlang-questions] missing function

Robert Virding rvirding@REDACTED
Tue Dec 23 13:12:42 CET 2008


There are two points about your question:

1. It is not strange that you cannot find such a function, it does not exist
in the libraries. :-)

2. It may also be strange that one does not exist, but so far no one has
seen a need to add it to lists where it would belong.

Robert

2008/12/23 Maxim Treskin <zerthurd@REDACTED>

> Hello
>
> I can't find standard function which returns position of element in list
> like:
>
> 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)
>     end.
>
> I think it strange. Can you clarify this point?
>
> Thank you.
>
> --
> Maxim Treskin
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081223/05b17c95/attachment.htm>


More information about the erlang-questions mailing list