Global logical variables

Syntax: A#B:=:X, or lval(A,B,X).

where X
is any term on the heap. It has simply a global name A#B i.e. an entry in the hashing table with keys A and B. The address in the table (C-pointers are the same as logical variables in BinProlog) is trailed such that on backtracking it will be unbound (i.e. point to itself). Unification with A#B:=:Y is possible at any point in the program which knows the `name' A#B.

Although a global logical variable cannot be changed it can be further instantiated as it happens to ordinary Prolog terms. Backtracking ensures they vanish so that no unsafe reference can be made to them.

The program lq8.pl is an efficient 8-queens program using global logical variables to simulate the chess-board.