please can give some of you advice about interception of three lists in Prolog?
I done interception of two lists:
prunik([], _, []).
prunik([H1|T1], L2, [H1|Res]) :-
member(H1, L2),
prunik(T1, L2, Res).
prunik([_|T1], L2, Res) :-
prunik(T1, L2, Res).
And it works, when I put this question:
prunik([1,3,5,2,4], [6,1,2], X).
I try remake this for three lists, but I really dont know. Any advice, please?
Your code for intersecting two lists is a bit faulty, see the last 3 answers:
But if you would like to extend your code to work on three lists:
Sample input/output: