A data structure for more efficient runtime support of truly functional arrays

Functional languages often neglect the array construct because it is hard to implement nicely in a functional language. When it is considered, it is usually from the context of converting imperative algorithms into functional programs, rather than from a truly functional perspective. In an imperative language, changes to an array are done by modifying array elements, destroying their original values. Unless special measures are taken to support destructive update, an array update in a functional language must produce a new array, without destroying the old one. Since most other functional data structures do not support destructive update, it would be desirable not to have to make a special case of arrays, especially since many kinds of algorithms (backtracking algorithms being a simple example) may find having multiple versions of a data-structure useful. Our goal is to be able to provide a functional array interface where array operations are reasonably cheap. We will look existing techniques that have been used in the past to address this problem area, and then present a new runtime technique that offers very good all-round performance, and can be used where other array mechanisms fail.

[1]  Henry G. Baker,et al.  Shallow binding in Lisp 1.5 , 1978, CACM.

[2]  Philip Wadler,et al.  Combining Monads , 1992 .

[3]  Paul Hudak,et al.  The aggregate update problem in functional programming systems , 1985, POPL.

[4]  Paul F. Dietz,et al.  Two algorithms for maintaining order in a list , 1987, STOC.

[5]  F. Burton,et al.  Manipulation Multilinked Data Structures in a Pure Functional Language , 1990, Software, Practice & Experience.

[6]  Henry G. Baker,et al.  Shallow binding makes functional arrays fast , 1991, SIGP.

[7]  Adrienne G. Bloss Update analysis and the efficient implementation of functional aggregates , 1989, FPCA.

[8]  Philip Wadler,et al.  Comprehending monads , 1990, Mathematical Structures in Computer Science.

[9]  Robert E. Tarjan,et al.  Making data structures persistent , 1986, STOC '86.

[10]  David A. Schmidt Detecting global variables in denotational specifications , 1985, TOPL.

[11]  R. Hindley The Principal Type-Scheme of an Object in Combinatory Logic , 1969 .

[12]  Olivier Danvy,et al.  Abstracting control , 1990, LISP and Functional Programming.

[13]  Robert E. Tarjan,et al.  Self-adjusting binary search trees , 1985, JACM.

[14]  J. Lambek,et al.  Introduction to higher order categorical logic , 1986 .

[15]  Philip Wadler,et al.  The essence of functional programming , 1992, POPL '92.

[16]  David Turner An overview of Miranda , 1986, SIGP.

[17]  Walter F. Tichy,et al.  Implementation and evaluation of a revision control system , 1982 .

[18]  Annika Aasa,et al.  An efficiency comparison of some representations of purely functional arrays , 1988, BIT Comput. Sci. Sect..

[19]  Robin Milner,et al.  Definition of standard ML , 1990 .

[20]  Marinus J. Plasmeijer,et al.  High Level Specification of I/O in Functional Languages , 1992, Functional Programming.

[21]  Philip Wadler,et al.  Linear Types can Change the World! , 1990, Programming Concepts and Methods.

[22]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.