Efficient Implementation of Side-Effective Arrays in Prolog
Original Publication Date: 1988-Oct-01
Included in the Prior Art Database: 2005-Feb-15
This article describes an efficient implementation of side-effective arrays in Prolog by utilizing a lazy copy algorithm and, consequently, reducing the number of copying terms between the global stack and the heap area. In conventional Prolog programming, side-effective predicates, such as addax or assert, have been used to keep values of logical variables over backtrackings as well as to change a rule base. However, for each execution of addax or assert, the values of the variables in a term are always copied to the heap area, whether the copy is needed or not. This stubborn copy mechanism is liable to overheads. In order to resolve the overheads, a side-effective array is herewith introduced. (Image Omitted) Fig. 1 shows Prolog predicates for array operations.