How this program works in Prolog?

Given a program in Prolog. Please explain how it works?
count(_,[],0).

count(X,[X|L],N):-count(X,L,N2),N is N2 + 1.

count(X,[_|L],N):-count(X,L,N).
p([],_,[]).
p([X|V],N,[X|L]):-count(X,[X|V],K),K >= N, delete(V,X,V2) p(V2,N,L).

p([X|V],N,L):-delete(V,X,V2) p(V2,N,L).


This program deletes from the input list all the elements that occur in the list more than N times.
August 19th 19 at 22:51
0 answer

Find more questions by tags Prolog