_is called the anonymous variable. Multiple occurrences of
_in a single term are not shared.
) or it is a fact. For example:
parent(X) :- father(X, _).
johnis a person.
foo(a, b, c)is said to be a term belonging to the functor foo/3 . foo/0 is used to refer to the atom
). This is an atom or compound term.
) separating head from body in a clause.
In Prolog, the expression
a+b is exactly the same as the
?- A = B, A = a. A = B, B = a.
_(see anonymous). Rules for naming a variable and avoiding a warning are given in section 184.108.40.206.
?- foo(a, B) = foo(A, b). A = a, B = b.
Unlike assignment (which does not exist in Prolog), unification is not directed.
?- A = b, A = c. false. ?- (A = b; true; A = c). A = b ; true ; A = c .
See also unify.