in prolog I have my database set up like this
male("John").
male("Bob").
male("Billy").
male("Gary").
Parent("Bob","John").
Parent("Billy","Bob").
Parent("Gary", "Billy").
ancestor(Ancestor, Descendant) :-
parent(Ancestor, Descendant).
ancestor(Ancestor, Descendant) :-
parent(Ancestor, CommonAncestor),
ancestor(CommonAncestor, Descendant).
Would it be possible to track how far into recursion this ancestor function went? for example if we ran
?- ancestor("Billy", "John", X).
Would it be possible to have X return 2, or in the case of
?- ancestor("Bob", "John", X).
have X return 1?