Count the number of SubTerms in Term that unify
with SubTerm. As this predicate is implemented using
backtracking, SubTerm and Term are not further
instantiated. Possible constraints are enforced. For example, we can
count the integers in Term using
?- freeze(S, integer(S)), occurrences_of_term(S, f(1,2,a), C).
C = 2,
freeze(S, integer(S)).
- See also
- occurrences_of_var/3
for an equality (==/2)
based variant.