Skip to content

Instantly share code, notes, and snippets.

@jaym
Created April 14, 2014 01:08
Show Gist options
  • Save jaym/10609107 to your computer and use it in GitHub Desktop.
Save jaym/10609107 to your computer and use it in GitHub Desktop.
-module(problem08).
-compile(export_all).
%
% Eliminate consecutive duplicates of list elements.
%
eliminate_duplicates(L) ->
lists:reverse(
lists:foldl(
fun(X, [X|AccIn]) ->
[X|AccIn];
(X, AccIn) ->
[X|AccIn]
end, [], L)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment