Skip to content

Instantly share code, notes, and snippets.

@jacobat
Created October 1, 2022 15:10
Show Gist options
  • Save jacobat/04ccfbc84c50daa83ae0db42a17dd1ad to your computer and use it in GitHub Desktop.
Save jacobat/04ccfbc84c50daa83ae0db42a17dd1ad to your computer and use it in GitHub Desktop.
Enum.reduce_while(list, [], fn x, acc ->
if Enum.member?(acc, x), do: {:halt, x}, else: {:cont, [x | acc]}
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment