[ Type Testing | The ECLiPSe Built-In Predicates | 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.
?Term
Prolog term.
-Variable
A variable.

Description

Used to test whether Term is not ground i.e. whether it contains at least one free 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, metaterms are also considered variables.

Fail Conditions

Fails if Term is ground.

Resatisfiable

No.

Examples

Success:
    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}

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



See Also

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