I don't understand what exactly these following 4 predicates do:
predicate1([H1,H2|T1],X) :−
append([H1,H2|T1],[H2,H1|T1],X).
predicate2wrapper(In, Out) :-
predicate2([ ], In, Out).
predicate2(L, [ ], L).
predicate2(A,[H| T], Out) :-
predicate2([H,H|A],T, Out).
predicate3([X,X], [X,X|_]).
predicate3([X,X], [_,H|T]) :−
predicate3([X,X],[H|T]).
predicate4([ ], _) .
predicate4([H|T], L) :−
member(H,L),
predicate4(T,L).
I know that all these predicates take lists as their argument(s) and I also tried to run them but I always get a Syntax error: operator expected warning.
Could someone please help me understand what these predicates do and maybe also help me fix this error?