Purely functional random-access lists

We present a new data structure, called a random-access list, that supports array lookup and update operations in O(log n) time, while simultaneously providing O(1) time list operations (cons, head, tad). A closer analysis of the array operations improves the bound to O(min{i, log n}) in the worst case and O(log i) in the expected case, where i is the index of the desired element. Empirical evidence suggests that this data structure should be quite efficient in practice.

[1]  Benjamin Goldberg,et al.  Real-time deques, multihead Turing machines, and purely functional programming , 1993, FPCA '93.

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

[3]  Edsger W. Dijkstra,et al.  A Discipline of Programming , 1976 .

[4]  John H. Reppy,et al.  Abstract Value Constructors: Symbolic Constants for Standard ML , 1992 .

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

[6]  Uday S. Reddy,et al.  Imperative functional programming , 1996, CSUR.

[7]  Greg N. Frederickson,et al.  Planar graph decomposition and all pairs shortest paths , 1991, JACM.

[8]  Martin Odersky,et al.  How to make destructive updates less destructive , 1991, POPL '91.

[9]  Philip Wadler,et al.  Views: a way for pattern matching to cohabit with data abstraction , 1987, POPL '87.

[10]  Richard Cole,et al.  River Routing Every Which Way, but Loose (Extended Abstract) , 1984, FOCS.

[11]  Zena M. Ariola,et al.  Order-of-evaluation analysis for destructive updates in strict functional languages with flat aggregates , 1993, FPCA '93.

[12]  Alok Aggarwal,et al.  Computing external farthest neighbors for a simple polygon , 1991, Discret. Appl. Math..

[13]  Andrew W. Appel,et al.  Unrolling lists , 1994, LFP '94.

[14]  Zvi Galil,et al.  On pointers versus addresses , 1992, JACM.

[15]  Robert E. Tarjan,et al.  Deques with Heap Order , 1986, Inf. Process. Lett..

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

[17]  Haim Kaplan,et al.  Persistent lists with catenation via recursive slow-down , 1995, STOC '95.

[18]  Chris Okasaki,et al.  Simple and efficient purely functional queues and deques , 1995, Journal of Functional Programming.

[19]  Tyng-Ruey Chuang A randomized implementation of multiple functional arrays , 1994, LFP '94.

[20]  Eugene W. Myers,et al.  An Applicative Random-Access Stack , 1983, Inf. Process. Lett..

[21]  Robert Todd Hood,et al.  The Efficient Implementation of Very-high-level Programming Language Constructs , 1982 .

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

[23]  Jean Vuillemin,et al.  A data structure for manipulating priority queues , 1978, CACM.

[24]  Paul F. Dietz Fully Persistent Arrays (Extended Array) , 1989, WADS.

[25]  S. Rao Kosaraju,et al.  Localized search in sorted lists , 1981, STOC '81.

[26]  Athanasios K. Tsakalidis,et al.  AVL-Trees for Localized Search , 1984, ICALP.

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

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

[29]  Rob R. Hoogerwoord,et al.  A Logarithmic Implementation of Flexible Arrays , 1992, MPC.

[30]  F. Warren Burton,et al.  Pattern matching with abstract data types , 1993, Journal of Functional Programming.

[31]  Eugene W. Myers,et al.  Efficient applicative data types , 1984, POPL.

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

[33]  Lawrence Charles Paulson,et al.  ML for the working programmer , 1991 .

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

[35]  Robert HOOD,et al.  Real-Time Queue Operation in Pure LISP , 1980, Inf. Process. Lett..

[36]  Simon L. Peyton Jones,et al.  Imperative functional programming , 1993, POPL '93.

[37]  Henry Lieberman,et al.  A real-time garbage collector based on the lifetimes of objects , 1983, CACM.