I want to know if a list contains any value more than once. Here is what I have.
has_dupes(List) -> has_dupes(List, []). has_dupes([Item|List], Seen) -> case lists:filter(fun(Elem) -> Elem == Item end, Seen) of [] -> has_dupes(List, [Item|Seen]); _ -> true end; has_dupes([], _Seen) -> false.
Is there an easier / more concise / more idiomatic way to do this? I am new to Erlang.
source share