Two algorithms are considered for implementation in Prolog. It is shown that these algorithms cannot be implemented in pure Prolog and retain their nominal time complexity. It is shown that a generalization of Lisp's rplaca/rplacd construct suffices for these algorithms. We give a method for the implementation of the new construct, rplacarg, on a structure-copying Warren Abstract Machine and discuss implementation for a structure-sharing Warren Abstract Machine. We show how rplacarg may be implemented in CProlog using only pure Prolog constructs and the var construct. We show that var can be implemented in terms of the Prolog not primitive. We show that rplacarg can be used to implement multidimensional arrays efficiently in Prolog.
Details
Title
Data Structures and Destructive Assignment in Prolog
Usage Statement
Researchers may make free and open use of the UC Berkeley Library’s digitized public domain materials. However, some materials in our online collections may be protected by U.S. copyright law (Title 17, U.S.C.). Use or reproduction of materials protected by copyright beyond that allowed by fair use (Title 17, U.S.C. § 107) requires permission from the copyright owners. The use or reproduction of some materials may also be restricted by terms of University of California gift or purchase agreements, privacy and publicity rights, or trademark law. Responsibility for determining rights status and permissibility of any use or reproduction rests exclusively with the researcher. To learn more or make inquiries, please see our permissions policies (https://www.lib.berkeley.edu/about/permissions-policies).