domains num integer list num predicates numberOfEntries list num num n

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
domains
num = integer
list = num*
predicates
numberOfEntries (list, num, num)
numberOfEntries2 (list , num)
clauses
numberOfEntries ([], _, Number) :- Number = 0.
numberOfEntries ([H|T], X, Number) :- numberOfEntries (T, X, NewNumber),
H = X, Number = NewNumber + 1.
numberOfEntries ([H|T], X, Number) :- numberOfEntries (T, X, NewNumber),
H <> X, Number = NewNumber.