domain_error(not_less_then_zero, Arg)
if Arg
< 0.
This predicate may be used for destructive assignment to terms, using them as and extra-logical storage bin. Always try hard to avoid the use of setarg/3 as it is not supported by many Prolog systems and one has to be very careful about unexpected copying as well as unexpected not copying of terms.
?- foo(hello, X) =.. List. List = [foo, hello, X] ?- Term =.. [baz, foo(1)] Term = baz(foo(1)) |
$VAR(N)
,
where N is the number of the variable. Counting starts at
Start. End is unified with the number that should
be given to the next variable. Example:
?- numbervars(foo(A, B, A), 0, End). A = '$VAR'(0) B = '$VAR'(1) End = 2 |
See also the numbervars
option to write_term/3
and numbervars/4.
$VAR
the function symbol is
determined by extra FunctionSymbol argument.
?- free_variables(a(X, b(Y, X), Z), L). L = [G367, G366, G371] X = G367 Y = G366 Z = G371 |
copy_term(In, Out) :- recorda(copy_key, In, Ref), recorded(copy_key, Out, Ref), erase(Ref). |
Note that as copy_term/2 does not create copies for ground terms setarg/3 affects both the copy and original.