Skip to content

Instantly share code, notes, and snippets.

@adrianparvino
Created June 11, 2019 19:49
Show Gist options
  • Save adrianparvino/f6adc96b773799e16d042f10ce2f104f to your computer and use it in GitHub Desktop.
Save adrianparvino/f6adc96b773799e16d042f10ce2f104f to your computer and use it in GitHub Desktop.
index = Enum.find_index(threads, &(selected == &1))
if index == length threads - 1 do
model
else
Map.replace!(model, :selected, Enum.at(threads, index + 1))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment