[ Non-logical Variables, Arrays, Bags, Shelves and Stores | Reference Manual | Alphabetic Index ]

local variable(+Name)

Creates the untyped non-logical variable Name.
Name
An atom.

Description

If Name is an Atom, a non-logical variable (visible only in the context module) is created. Its value is initialised to a free variable. The contents of the variable persists across failures. The value of a non-logical variable can be changed with setval/2 and retrieved with getval/2. Setting and retrieving terms from a non-logical variable involves copying the term each time. In particular, if the term contains variables, they lose their identity and are replaced with fresh ones.

Notes:

Declaring a variable twice is silently accepted.

Modes and Determinism

Exceptions

(4) instantiation fault
Name is not instantiated.
(5) type error
Name is not an atom.

Examples

Success:
      :- local variable(a).
      :- local variable(count), variable(value).

Error:
      :- local variable(X).                        (Error 4).
      :- local variable(6).                        (Error 5).

See Also

current_array / 2, array / 1, array / 2, decval / 1, incval / 1, bag_create / 1, getval / 2, setval / 2, reference / 2, variable / 2