[ ECLiPSe Type Testing built-in.|Group Index| Full Index]

var(?Var)

Succeeds if Var is a variable or a metaterm.

?Var
Prolog term.

Description

Used to test whether Var is a variable or a metaterm. The difference between var/1 and free/1 is that var/1 succeeds on metaterms as well.

var/1 could be defined as

    var(X) :- free(X).
    var(X) :- meta(X).

Fail Conditions

Fails if Var is instantiated.

Resatisfiable

No.

Exceptions

Examples


Success:
      var(X).
      var(_abc).
      var(_).
      var(X{a}).
      coroutine, X>0, var(X).

Fail:
      var(atom).
      var('Abc').


See Also

free / 1, meta / 1, nonground / 1, nonvar / 1, type_of / 2