Remove the second and succeeding adjacent duplicates.
So that [a,a,a,b,b,c] should become [a,b,c].
Can someone please help me. I have an assignment due and i just don't have a clue. I'm trying to start by checking if the first element is a member of the rest of the tail of the list. But i'm not sure what to do next.
listt([],[]).
listt([H|T],[R]):-
member(H,T),
????.
member(X, [X|Head]).
member(X, [Head|Tail]) :- member(X, Tail).
So that [a,a,a,b,b,c] should become [a,b,c].
Can someone please help me. I have an assignment due and i just don't have a clue. I'm trying to start by checking if the first element is a member of the rest of the tail of the list. But i'm not sure what to do next.
listt([],[]).
listt([H|T],[R]):-
member(H,T),
????.
member(X, [X|Head]).
member(X, [Head|Tail]) :- member(X, Tail).