I am completely new to Prolog and trying some exercises. One of them is:
Write a predicate set(InList,OutList) which takes as input an arbitrary l
I think that a better way to do this would be:
set([], []). set([H|T], [H|T1]) :- subtract(T, [H], T2), set(T2, T1).
So, for example ?- set([1,4,1,1,3,4],S) give you as output:
?- set([1,4,1,1,3,4],S)
S = [1, 4, 3]