比如有两个列表SWI序言:列表操作
List1 = [ [1,2,3,4], [2,4,5,4],[4,5,2,5],.....]
List2= [ [2,4,4,1], [5,6,1,2], [4,2,3,4],.....]
现在我想看看这两个列表,每个列表的第三个元素比较表1的内部,即与列表2。如果它们相同,则将列表保留在list1中,然后继续下一个。如果它们不相同,则将列表1中的列表放在不同的列表(即列表3)中。所以 类似
compare([][][]).
compare([[firstele, second ele, third ele, fourth ele]|list1],[firstele2, second ele2, third ele2, fourth ele2]|list2],list3):-
....... condition......
我该怎么做?
你能添加预期的输出吗? –