In our code we're running:
Enum.uniq(something)
We're getting the following error:
no function clause matching in Enum.uniq_list/3
lib/enum.ex in Enum.uniq_list/3 at line 3655
arg0 nil # THIS SHOULD NEVER HAPPEN
arg1 %{86078 => true, 86079 => true, 86080 => true, 86081 => true, 86082 => true, 86083 => true, 86084 => true}
arg2 #Function<217.29191728/1 in Enum.uniq/1>
Enum.uniq_list/3 is a private function in the code of Enum (see here):
defp uniq_list([head | tail], set, fun) do
value = fun.(head)
case set do
%{^value => true} -> uniq_list(tail, set, fun)
%{} -> [head | uniq_list(tail, Map.put(set, value, true), fun)]
end
end
defp uniq_list([], _set, _fun) do
[]
end
The first time we call the function, the first argument is our something enumerable. From the error we know that it has some values (86078, 86079, ...).
What could be in the enumerable so the argument ends up being nil?
somethingas it seems that the error depends heavily on the input parameter. - pasjasomethingis. In my tests I never get a nil value. - Alansomethingneeds to be a list - GavinBrelstaff