Abstract
In pure functional programs it is common to represent arrays by association lists. Association lists have the disadvantage that the access time varies linearly both with the size of the array (counted in number of entries) and with the size of the index (counted in cons nodes). This paper presents another simple representation of arrays for which the access time varies linearly in the size of the index but is independent of the size of the array. The paper compares this representation with association lists in functional languages and arrays in imperative languages.
This paper also considers lazy programming and states how to use potentially infinite arrays for time optimization for certain programs.
Similar content being viewed by others
References
Barendregt, H. P. The lambda calculus, its syntax and semantics.Studies in Logic and The Foundations of Mathematics 103, North-Holland 1984.
Berkling, K. J.Reduction languages for reduction machines. ISF-76-8, Gesellschaft für Mathematik und Datenverarbeitung MBH Bonn, Institut für Informationssystemforschung, 1976. (Also shorter version in2nd Annual Symposium Computer Architecture, Houston, 1975).
Burge, W.H.Recursive programming techniques. Addison-Wesley, 1975.
Friedman, D. P., Wise, D. S. CONS should not evaluate its arguments. 257–284 in: Michaelson, S. and Milner, R., Ed.,Automata, Languages and Programming. Edinburgh University Press, 1976.
Grue, K. E. An efficient formal theory. Diku report 14/87, Diku 1987.
Henderson, P. and Morris, J. H., Jr. A lazy evaluator.Conference Record of the Third ACM Symposium on Principles of Programming Languages, ACM, 1976.
Henderson, P.Functional programming, application and implementation. Prentice-Hall, 1980.
Hughes, J.An Efficient Implementation of Purely Functional Arrays. To appear.
McCarthy, J. Recursive functions of symbolic expressions and their computation by machine.Comm. ACM, 1960, 184–195.
McCarthy, J., Abrahams, P. W., Edwards, D. J., Hart, T. P. and Levin, M. I.LISP 1.5 Programmer's Manual, The M.I.T. Press, 1962.
Sato, M. Theory of symbolic expressions, I.Theoretical Computer Science 22, (1983), 19–55.
Tarjan, R. E. Data Structures and Network Algorithms,CBMS-NSF Regional Conference Series in Applied Mathematics 44, SIAM (1983).
Tarjan, R. E. Algorithm Design,Communications of the ACM,30 204–212, (March 1987)
Turner, D. A. A New Implementation Technique for Applicative Languages.Software Practice and Experience 9 (1979) 31–49.
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Grue, K.E. Arrays in pure functional programming languages. Lisp and Symbolic Computation 2, 105–113 (1989). https://doi.org/10.1007/BF01811535
Issue Date:
DOI: https://doi.org/10.1007/BF01811535