I am currently trying to find all elements of Lists L1 and L2 that are different from each other and append them into List L.
So far, I tried the following:
difference(L1, L2, L) :-
findall(H, (member(H,L1),\+member(H, L2)), L).
However, I only get an empty list when I query the following:
|?- difference([1,2,3],[1,2,3,4,5,6], L).
I also tried querying the following:
|?- difference([1,2,3,4,5,6],[1,2,3], L).
Interestingly, for this one I get L = [4,5,6]. How can I rewrite my fact to for it to work also with the first query?