You can use the Enum.any?. There is excellent documentation.
Or you can roll your own.
def do_something([], _item, data), do: data
def do_something([h | t], item, data) do
data =
if h == item, do: [h | data], else: data
do_something(t, item, data)
end
Essentially, you are doing your check and calling with the remainder of the list. I recommend looking at the Enum library it has everything you need.






















