I am trying to find index_value for an element in the list which is duplicate
[%{day: "mon", name: "Doc"}, %{day: "mon", name: "Doctor"}, %{day: "mon", name: "Doctor"}, %{day: "wed", name: "Doc"}, %{day: "wed", name: "Doc"}]
I am only concerned about day.
When I try
list |> Enum.find_index(fn hour -> hour.day == "mon" end)
this gives me 0, where "mon" has 3 items.
I want to get the very last index value, anyhow my main purpose is to get use that index to get the very next value to it.
In this case , I am trying to get
%{day: "wed", name: "Doc"}
any help would be grateful, thank you.