Hello and thank you for taking the time to read this question. I have the following problem:
Given a list that returned the number of numbers greater than X Example:
greater (4, [1,2,3,4,5,6], N) Result. N = 2 My code is:
greater(0,[],0):-!, fail.
greater(N,[N],1).
greater(N,[H|Q],X):-H>N,greater(Q,N,X),X is X+1.
The problem is that PROLOG only returns False but not the value of X.
I hope you can explain to me what I am doing wrong, I thank you in advance for your