| | |
Summary: LA Circular Programs 1
.so /staff/lloyd/specsyms
Circular Programs and SelfReferential Structures.
Lloyd Allison
Department of Computer Science
Monash University
Clayton
Victoria
Australia 3168.
uucp: lloyd@bruce.cs.monash.edu.au
written: 17 November 1987
revised: 17 May and 18 August 1988
Appeared in Software Practice and Experience 19(2) 99109 Feb 1989.
Abstract: A circular program creates a data structure whose computation depends upon itself or refers to
itself. The technique is used to implement the classic data structures circular and doublylinked lists,
threaded trees and queues, in a functional programming language. These structures are normally thought to
require updatable variables found in imperative languages. For example, a functional program to perform
the breadthfirst traversal of a tree is given. Some of the examples result in circular data structures when
evaluated. Some examples are particularly spaceefficient by avoiding the creation of intermediate
temporary structures which would otherwise later become garbage. Lastly, the technique can be applied in
|