Skip to main content
Log in

Arrays in pure functional programming languages

  • Published:
LISP and Symbolic Computation

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Barendregt, H. P. The lambda calculus, its syntax and semantics.Studies in Logic and The Foundations of Mathematics 103, North-Holland 1984.

  2. 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).

  3. Burge, W.H.Recursive programming techniques. Addison-Wesley, 1975.

  4. 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.

  5. Grue, K. E. An efficient formal theory. Diku report 14/87, Diku 1987.

  6. Henderson, P. and Morris, J. H., Jr. A lazy evaluator.Conference Record of the Third ACM Symposium on Principles of Programming Languages, ACM, 1976.

  7. Henderson, P.Functional programming, application and implementation. Prentice-Hall, 1980.

  8. Hughes, J.An Efficient Implementation of Purely Functional Arrays. To appear.

  9. McCarthy, J. Recursive functions of symbolic expressions and their computation by machine.Comm. ACM, 1960, 184–195.

  10. 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.

  11. Sato, M. Theory of symbolic expressions, I.Theoretical Computer Science 22, (1983), 19–55.

    Google Scholar 

  12. Tarjan, R. E. Data Structures and Network Algorithms,CBMS-NSF Regional Conference Series in Applied Mathematics 44, SIAM (1983).

  13. Tarjan, R. E. Algorithm Design,Communications of the ACM,30 204–212, (March 1987)

    Google Scholar 

  14. Turner, D. A. A New Implementation Technique for Applicative Languages.Software Practice and Experience 9 (1979) 31–49.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints 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

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01811535

Keywords

Navigation