[ Type Testing | Reference Manual | Alphabetic Index ]

nonground(?Term, -Variable)

Succeeds if Term is not a ground term and binds Variable to one of the variables inside Term.
Prolog term.
A variable.


Used to test whether Term is not ground i.e. whether it contains at least one uninstantiated variable. The argument Variable is unified with one of the variables inside Term, i.e. with one of the responsibles for its non-groundness. When Term contains several variables, it is not specified which one will be returned as Variable. As usual, attributed variables are also considered variables.

This predicate can handle cyclic terms.

Modes and Determinism

Fail Conditions

Fails if Term is ground


    nonground(Term, V).       % unifies V with Term
    nonground(f(a,B,c), V).   % unifies V with B
    nonground([x,Y|Z], V).    % unifies V with Y or Z
    nonground(s(X{a}), V).    % unifies V with X{a}

    nonground(atom, V).
    nonground(likes(man, woman), V).

See Also

nonground / 1, nonground / 3, nonvar / 1, var / 1