[erlang-questions] Getting the position of a list item

Zoltan Lajos Kis <>
Wed Dec 2 18:53:08 CET 2009


Robert Raschke wrote:
> On Wed, Dec 2, 2009 at 5:10 PM, Garrett Smith <> wrote:
>
>   
>> I'm missing something basic here :\
>>
>> The lists module has keyfind/3 but no find/2, where you want to return
>> the position of a particular list item. This is surprising.
>>
>> Is there a commonly used pattern for this?
>>
>>
>>
>>     
> Hmm, I fail to come up with a good usage scenario for wanting this. What are
> you needing the position of an item in a list for?
>
> Robby
>
>   
Find a good usage for lists:nth/2 and lists:nthtail/2 functions, and you 
will find a good one for this :).



More information about the erlang-questions mailing list