Created
September 28, 2022 09:39
-
-
Save mavuio/543b04c842800aeac4077266149fcefd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_next_in_list(list, item) when is_list(list) do | |
Enum.find_index(list, fn e -> e == item end) | |
|> case do | |
nil -> | |
nil | |
idx -> | |
Enum.at(list, idx + 1) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment