summaryrefslogtreecommitdiff
path: root/prolog/problems/sets/union_3/common.py
blob: 2a1424511921c7dcb76978da077bcf3aba4faa6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# coding=utf-8

id = 128
number = 35
visible = True
facts = None

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

union([], S2, S2).
union([H|T], S2, [H|U]) :-
  \+ memb128(H, S2),
  union(T, S2, U).
union([H|T], S2, U) :-
  memb128(H, S2),
  union(T, S2, U).
'''