library(terms)
This library module provides miscellaneous operations on terms. Exported predicates:
subsumeschk(
+General,
+Specific)
subsumes(
+General,
+Specific)
variant(
+Term,
+Variant)
term_subsumer(
+Term1,
+Term2,
-Term)
term_hash(
+Term,
-Hash)
term_hash(
+Term,
+Depth,
+Range,
-Hash)
term_variables(
+Term,
-Variables)
term_variables_bag(
+Term,
-Variables)
acyclic_term(
+X)
cyclic_term(
+X)
term_order(
+X,
+Y,
-R)
<
, =
, or >
according
as X @< Y, X == Y, or X @> Y. This is the same as compare/3
, except
for the argument order.
contains_term(
+Kernel,
+Expression)
sub_term/2
.
free_of_term(
+Kernel,
+Expression)
occurrences_of_term(
+Kernel,
+Expression,
-Tally)
sub_term/2
and then
test them with this routine. If you just want to find out
whether Kernel occurs in Expression or not, use contains_term/2
or free_of_term/2
.
contains_var(
+Variable,
+Term)
==
to check for
the variable (contains_term/2
uses =
) so it can be used to check
for arbitrary terms, not just variables.
free_of_var(
+Variable,
+Term)
occurrences_of_var(
+Term,
+Variable,
-Tally)
sub_term/2
and then
test them with this routine. If you just want to find out
whether Variable occurs in Term or not, use contains_var/2
or free_of_var/2
.
sub_term(
?Kernel,
+Term)
depth_bound(
+Term,
+Bound)
term_depth/2
.
length_bound(
?List,
+Bound)
size_bound(
+Term,
+Bound)
term_size/2
.
term_depth(
+Term,
-Depth)
calculates the Depth of a Term, using the definition term_depth(Var) = 0 term_depth(Const) = 0 term_depth(F(T1,...,Tn)) = 1+max(term_depth(T1),...,term_depth(Tn))
term_size(
+Term,
-Size)
same_functor(
?T1,
?T2)
same_functor(
?T1,
?T2,
?N)
same_functor/3
, at least one of T1 and T2
must be bound, or an error will be reported.
same_functor(
?T1,
?T2,
?F,
?N)