summaryrefslogtreecommitdiff
path: root/prolog/problems/sets/intersect_3/common.py
blob: ffa4f899db09232781cca9017b2f3dbdf0a8602b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
id = 129
group = 'sets'
number = 36
visible = True
facts = None

solution = '''\
memb129(X, [X|_]).
memb129(X, [_|T]) :-
  memb129(X, T).

intersect([], _, []).
intersect([H|T], S2, [H|I]) :-
  memb129(H, S2), !,
  intersect(T, S2, I).
intersect([_|T], S2, I):-
  intersect(T, S2, I).
'''