Fast Functional Lists
Since J. McCarthy first introduced Functional Programming, the Linked List has almost universally been used as the underpinning data structure. This paper introduces a new data structure, the VList, that is compact, thread safe and significantly faster to use than Linked Lists for nearly all list operations. Space usage can be reduced by 50% to 90% and in typical list operations speed improved by factors ranging from 4 to 20 or more. Some important operations such as indexing and length are typically changed from O(N) to O(1) and O(lgN) respectively. In the current form the VList structure can provide an alternative heap architecture for functional languages using eager evaluation. To prove the viability of the new structure a language interpreter Visp, a dialect of Common Lisp, has been implemented using VList and a simple benchmark comparison with OCAML reported.
KeywordsGarbage Collection Functional Language List Structure List Operation Small List
Unable to display preview. Download preview PDF.
- 1.Zhong Shao and John H. Reppy and Andrew W. Appel: Unrolling Lists. Conference record of the 1994 (ACM) Conference on Lisp and Functional Programming (1994) 185–191Google Scholar
- 2.Zhong Shao: Compiling Standard ML for Efficient Execution on Modern Machines (Thesis) TR-475-94 (1994) 169Google Scholar
- 5.Chris Okasaki: Purely Functional Random-Access Lists. Functional Programming Languages and Computer Architecture (1995) 86–95Google Scholar
- 7.R Greenblatt: LISP Machine Progress Report memo 444 (Aug 1977) 169 A.I. Lab., M.I.T., Cambridge, Mass.Google Scholar
- 8.D.W. Clark: List Structure: Measurements, Algorithms, and Encodings, (Ph.D. Thesis Aug 1976) Dept. of Computer Science, Carnegie-Mellon UniversityGoogle Scholar
- 10.Andrej Brodnik and Svante Carlsson and Erik D. Demaine and J. Ian Munro and Robert Sedgewick: Resizable Arrays in Optimal Time and Space. Workshop on Algorithms and Data Structures (1999) 37–48Google Scholar