Skip to content

Instantly share code, notes, and snippets.

@arcusfelis
Created November 26, 2012 18:03
Show Gist options
  • Select an option

  • Save arcusfelis/4149686 to your computer and use it in GitHub Desktop.

Select an option

Save arcusfelis/4149686 to your computer and use it in GitHub Desktop.
Delete all duplicates of a single element from the string
delete_duplicate(E, [E|T]) ->
T2 = [X || X <- T, X =/= E],
[E|T2];
delete_duplicate(E, [H|T]) ->
[H|delete_duplicate(E, T)];
delete_duplicate(_E, []) ->
[].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment