_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, _).
Expressed ``X is a parent if X is a father of someone''. See also variable and predicate.
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
) separating head from body in a clause.
In Prolog, the expression
a+b is exactly the same as the
?- A = B, A = a. A = a, B = a
_(see anonymous). Rules for naming a variable and avoiding a warning are given in section 220.127.116.11.
?- 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. No ?- (A = b; true; A = c). A = b ; A = _G283 ; A = c ; No
See also unify.