PROLOG DOUBLY-LINKED LIST PACKAGE Contributed by Philip Dart, Melbourne University Received on the 14th of November 1987 Shelved on the 6th of December 1987 This is my revised version of a doubly-linked list-handling package sent to the Prolog Digest by Philip Dart, Melbourne University. I've changed the syntax slightly so it fits Edinburgh Prolog: otherwise, the predicates are the same. Philip did send the original package as a joke... Following the comments [on the bulletin board] about Fortran as an AI language, Melbourne University Department of Artificial Intelligence has decided to convert all of its Fortran AI programs to NU-Prolog. This package has been written as an aid to this conversion. Doubly-linked list package: Why use boring old single-linked lists when doubly-linked list could make your list processing applications run as never before. P.S. Don't forget to turn off the occur-check in your version of Prolog! However, it seems to me that the package might be useful in those few cases where you really _do_ need circular structures (rather than using, e.g. edge-sets to represent graphs), and Philip has agreed to let me redistribute his package on this basis. [JNP] Predicates defined: test Demonstrate the predicates dPrev(D, _) Get previous node dNext(D, _) Get next node dHead(D, _) Get head of list dTail(D, _) Get tail of list isD(D) Is this a doubly-linked list? portray(D) Portray doubly-linked list dAppend(X, Y, Z) Append for doubly-linked lists dAdj(L, R) Are these adjacent nodes? SIZE : 6 kilobytes. CHECKED ON EDINBURGH-COMPATIBLE (POPLOG) PROLOG : yes. PORTABILITY : No problems, modulo the occurs check. INTERNAL DOCUMENTATION : One-line description of each predicate's specification.