2 Questions 1.How to find differences in lists in prolog and 2. Determine if the lists are the same
- by Alexander
1.If i have two lists say A and B made upp of different letters. [b,a,c] in list A and [b,d,c,e] in list B
how can i get prolog to give me C,which is a list of elements that A has which are not included in list B
Ex.
So if i type
difference([b,a,c],[b,d,c,e],C).
I want the answer to read:
C=[a]
If i have two lists where list A is made up off [a,b,c] and list B is [c,a,b]
i want the result to be Yes if i type:
same([a,b,c],[c,a,b]). since they contain the same elements the fact that they are in a different order does not matter. Also it should only answer yes if all of the elements are the same not if 3/4 are right.