count_successes
Entity: function

Usage:
N is count_successes(Goal)

Here Goal has to be an atomic goal. After the execution of this function the returned value N will contain the number of the times Goal succeeded. If Goal succeeds infinitely many times then this function will go in an infinite loop.

Example:

?-
read(X,"Say how many times"),
write(count_successes(p(X))),
nl.

p(X):-
for(I,1,X),
write("*").