
get_var_info(?Var, ?InfoName, -Value)

   Succeeds if Var is an uninstantiated variable, InfoName is a valid
information name and the information value Value unifies with the value of
the information.



Arguments
   Var                 Prolog Term, usually a variable.
   InfoName            Atom or variable.
   Value               Atom or variable.

Type
   Type Testing

Description
   This predicate is used to test the type of a free variable or to get its
   source name (when available).


   The possible values for InfoName are type or name.


   If InfoName unifies with name, the predicate will succeed if the source
   name of the free variable Var is available and unifies with Value.


   If InfoName unifies with type, the predicate will succeed if Value
   unifies with the type of the variable Var.


   The possible types are:



    meta      an attributed variable (metaterm)
    free      a free variable



Modes and Determinism
   get_var_info(?, +, -) is semidet
   get_var_info(?, -, -) is semidet

Fail Conditions
   Fails if Var is not a variable

Exceptions
     5 --- InfoName or Value is neither an atom nor a variable.
     6 --- InfoName is not an information name.

Examples
   
Success:
      ?- suspend:(Var1 > Var2), get_var_info(Var1, Info, Value).
      Var2 = Var2
      Var1 = Var1
      Info = name
      Value = 'Var1'
      Delayed goals:
       Var1 > Var2     More? (;)

      Var2 = Var2
      Var1 = Var1
      Info = type
      Value = meta

      Delayed goals:
       Var1 > Var2
      yes.

      ?- get_var_info(Var1, type, Type).
      Var1 = Var1
      Type = free
      yes.

      ?- set_flag(variable_names,off).
      yes.

      ?- get_var_info(Var1, name, Name).
      no (more) solution.

Fail:
      get_var_info(atom, name, Name).
      set_flag(variable_names, off),
          get_var_info(X, name, Name).

Error:
      get_var_info(X, not_an_info, Y).    (Error 6)
      get_var_info(X, type, 123).         (Error 5)






See Also
   set_flag / 2, type_of / 2, var / 1
