I don't know what I'm missing here.
I want to add an element if it is in arg1 but not in arg2 and want to remove an element if it is in arg1 but not in arg2.
I'm using an if condition with includes a function that return true if the element is in the arg2 list, false otherwise. Then use built in predicates append and select to add or remove.
I'm getting false to all my objectives searches. I comment and uncomment depending on what predicate I want, add or remove.
includes([],_).
includes([P|Z],S) :-
memberchk(P,S), includes(Z,S).
addop([],list,res).
addop([P|R],list,res) :-
includes(P,s0) -> addop(R,list,res) ; append(P,list,res),
addop(R,list,res).
rem([],list,res).
rem([P|R],list,res) :-
includes(P,list) -> rem(R,list,res) ; select(P,list,res),
rem(R,list,res).
Thanks for help.