I need prolog logic that determines if two lists have any elements in common. For example, if I have a list containing numbers [2,4,5,6,8] and a second list containing numbers [1,3,5,6,9] this will return true because they have 5 and 6 in common. However, [1,2,3] and [5,6,8] will return false because there are no common elements between these lists.
?- similarity([2,4,5,6,8], [1,3,5,6,9]).
?- similarity([1,2,3], [5,6,8]).
NO BUILT IN LOGIC. that includes disjoint, membership, intersection, etc.
I NEED THIS ASAP, BY TOMORROW. thanks.