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

id = 120
group = 'lists'
number = 27
visible = True
facts = None

solution = '''\
count(_, [], 0).
count(X, [X|T], N) :-
  count(X, T, NT),
  N is NT + 1.
count(X, [Y|T], NT) :-
  X \== Y,
  count(X, T, NT).
'''