Noeud: Meta-Logic, Noeud « Next »: Modification of the Program, Noeud « Previous »: Information about the State of the Program, Noeud « Up »: Built-In Predicates
The predicates in this section are meta-logical and perform operations that require reasoning about the current instantiation of terms or decomposing terms into their constituents. Such operations cannot be expressed using predicate definitions with a finite number of clauses.
var(?X)
nonvar(?X)
var/1.
ground(?X)
atom(?X)
integer(?X)
number(?X)
atomic(?X)
simple(?X)
compound(?X)
functor(+Term,?Name,?Arity)
functor(?Term,+Name,+Arity)
arg(+ArgNo,+Term,?Arg)
+Term =.. ?List
?Term =.. +List
%>dyalog -s "?-product(0, n, n-1) =.. L. "
Answer : L = [product,0,n,n - 1]
%>dyalog -s "?-n-1 =.. L. "
Answer : L = [-,n,1]
%>dyalog -s "?-product =.. L. "
Answer : L = [product]
If Term is uninstantiated, then List must be instantiated
either to a list of determinate length whose head is an atom, or to a
list of length 1 whose head is a number.
name(+Const,?CharList)
name(?Const,+CharList)
%>dyalog -s "?-name(product,L). "
Answer : L = [0'p,0'r,0'o,0'd,0'u,0'c,0't]
%>dyalog -s "?-name(1976,L). "
Answer : L = [0'1,0'9,0'7,0'6]
If Const is uninstantiated, CharList must be instantiated to
a list of characters. If CharList can be interpreted as a number,
Const is unified with that number, otherwise with the atom whose
name is CharList.
atom_chars(+Const,?CharList)
atom_chars(?Const,+CharList)
name(Const,CharList), but Const
is constrained to be an atom.
number_chars(+Const,?CharList)
number_chars(?Const,+CharList)
name(Const,CharList), but Const is
constrained to be a number.
term_subsumer(+Term1, +Term2, -General)
%>dyalog -s "?- term_subsumer(f(g(1,h(_))), f(g(_,h(1))), T). "
Answer : T = f(g(B__2,h(A__2)))
%>dyalog -s "?- term_subsumer(f(1+2,2+1), f(3+4,4+3), T). "
Answer : T = f(B__2 + C__2,C__2 + B__2)