Feedback on Erlang Lists processing function I have just started learning erlang...I am just practicing the recursion and all in erlang...I tried to write a few of the list processing functions on my own in erlang...Can someone review the code and give some advice on it...

-module(listma).
-export([duplicates/1,reverse/1])
%% Remove the duplicates in a list

duplicates(List) -&gt;
    duplicates(List,[]).

duplicates([Head|Tail],Newlist) -&gt;
    Insert = 
        fun(H,N) -&gt;  
            case [H] -- N of
                [] -&gt; N;
                [H] -&gt; [H|N]
            end
        end,
    duplicates(Tail,Insert(Head,Newlist));

duplicates([],Outputlist) -&gt;
    reverse(Outputlist).

%% Reverse a list

reverse(List) -&gt;
    reverse(List,[]).
reverse([Head|Tail],Newlist) -&gt;
    reverse(Tail,[Head|Newlist]);
reverse([],Outputlist) -&gt;
    Outputlist.
Your Insert lambda doesn't use any context so you could rewrite it as a top-level function or move its body to the clause.
And you could use lists:member/2 instead of --.

I'd write first clause like this:

duplicates([Head | Tail], Acc) -&gt;
   NewAcc = case lists:member(Head, Acc) of
               true -&gt;
                  Acc;
               _ -&gt;
                  [Head | Acc]
            end,
   duplicates(Tail, NewAcc);