Acta Informatica

, Volume 28, Issue 1, pp 43–81 | Cite as

Efficient memo-table management strategies

  • Hessam Khoshnevisan


A large, automatically detectable class of non-linear functions is defined and their evaluation graphs are characterised. These results are then used to develop space-efficient implementation ofmemo-functions. We generate a variant of memo-functions which can be used to linearise the time cost of calls of a non-linear function to itself whilst executing in bounded space. These memo-functions dynamically garbage collect (or reuse) memo-table entries when it is known that such entries will not be useful again. For each non-linear function a function called the “table-manager” function is synthesised by a static analysis of the definition of the non-linear function. The table-managers delete (or reuse) entries that are guaranteed to be obsolete as a result of any insertion into the memo-tables. In this way they ensure that the size of the tables is minimised. Furthermore, the sizes of the tables for these memo-functions are guaranteed not to exceed a compile-time constant found by the same static analysis which synthesises the table-managers. The applicability of the method also includes many problems which have been previously solved by applyingdynamic programming techniques. An implementation of these memo-functions for the functional language HOPE is also outlined.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [AbHa87] Abramsky, S., Hankin, C.L.: Abstract interpretation of declarative languages. Chichester: Ellis Horwood 1987Google Scholar
  2. [AhHoUl174] Aho, A.V., Hopcroft, J.E., Ullman, J.D.: The design and analysis of computer algorithms. Reading, Mass.: Addison-Wesley 1974MATHGoogle Scholar
  3. [Ba78] Backus, J.W.: Can programming be liberated from the von Neumann Style? A functional style and its algebra of programs. CACM21(8), 613–641 (1978)MATHMathSciNetGoogle Scholar
  4. [Ba81] Backus, J.W.: The algebra of functional programs: function level reasoning, linear equations and extended definitions. (Lect. Notes Comput. Sci., vol. 107, pp. 1–43) Berlin Heidelberg New York: Springer 1981Google Scholar
  5. [BaFiKh86] Bailey, R., Field, A.J., Khoshnevisan, H.: Efficient implementation of functional programs. Research Report, Department of Computing, Imperial College, London 1986Google Scholar
  6. [Be 75] Bellman, R.E.: Dynamic programming. Princeton, NJ: Princeton University Press 1975Google Scholar
  7. [Bi77] Bird, R.S.: Improving programs by the introduction of recursion. Commun. ACM20(11), 856–863 (1977)MATHCrossRefMathSciNetGoogle Scholar
  8. [Bi80] Bird, R.S.: Tabulation techniques for recursive programs. ACM Comput. Surveys12(4), 403–417 (1980)MATHCrossRefMathSciNetGoogle Scholar
  9. [Bi86] Bird, R.S.: Transformational programming and the paragraph problem. Sci. Comput. Program.6, 159–189 (1986)MATHCrossRefGoogle Scholar
  10. [BuDa77] Burstall, R.M., Darlington, J.: A transformation system for developing recursive programs. JACM24, No. 1 (1977)Google Scholar
  11. [BuMcSa80] Burstall, R.M., McQueen, D.B., Sannella, D.T.: HOPE: An experimental applicative language. Proceedings 1st International LISP conference, Stanford, pp. 136–143 (1980)Google Scholar
  12. [Co79] Cohen, N.H.: Characterisation and elimination of redundancy in recursive programs. 6th Annual ACM Symposium on Principles of Programming Languages. Antonio, Texas, pp. 143–157 (1979)Google Scholar
  13. [Co80] Cohen, N.H.: Source-to-Source improvement of recursive programs. Ph.D. thesis, Division of Applied Sciences, Harvard Univ, Cambridge, Mass. (1980)Google Scholar
  14. [Co83] Cohen, N.H.: Eliminating redundant recursive calls. ACM Trans. Program. Languages Systems5, 265–299 (1983)MATHCrossRefGoogle Scholar
  15. [Da79] Darlington, J., A synthesis of several sorting algorithms. Acta Inf.11, 1 (1979)MathSciNetGoogle Scholar
  16. [DaBu76] Darlington, J., Burstall, R.M.: A system which automatically improves programs. Acta Inf.6, 1 (1976)Google Scholar
  17. [GiKi84] Givler, J.S., Kieburtz, R.G.: Schema recognition for program transformation. ACM Symposium on LISP and Functional Programming, pp. 74–85 (1984)Google Scholar
  18. [Ha88] Harrison, P.G.: Linearisation: An optimisation for non-linear functional programs. Sci. Comput. Program.10, 281–318 (1988)MATHCrossRefMathSciNetGoogle Scholar
  19. [Hi76] Hilden, J.: Elimination of recursive calls using a small table of “randomly” selected function values. BIT16(1), 60–73 (1976)MATHCrossRefMathSciNetGoogle Scholar
  20. [Hu85] Hughes, J.: Lazy memo-functions. In: Jouannand, J.P. (ed.) Functional programming languages and computer architectures. (Lect. Notes Comput. Sci., vol. 201) Berlin Heidelberg New York: Springer 1985Google Scholar
  21. [Kh87] Khoshnevisan, H.: Automatic transformation systems based on function-level reasoning. Ph.D. thesis, Department of Computing, Imperial College, University of London (1987)Google Scholar
  22. [KeS181] Keller, R.M., Sleep, M.R.: APPLICATIVE CACHING: Programmer control of object sharing and lifetime in distributed implementations of applicative languages. ACM Conference on functional languages and computer architecture, Portsmouth, pp. 131–140 (1981)Google Scholar
  23. [Mc63] McCarthy, J.: Predicate calculus with undefined as a truth value. Stanford Artificial Intelligence Memo 1, Computer Science Dept., Stanford Univ., Stanford, Calif. (1963)Google Scholar
  24. [Mc] McCarthy, J.: On efficient ways of evaluating certain recursive functions. Project MAC A.I. Memo 32, M.I.T., Cambridge, Mass. (undated)Google Scholar
  25. [PaHe70] Paterson, M.S., Hewitt, C.E.: Comparative schematology. Record of project MAC Conference on concurrent systems and parallel computation, Woods Hole, Mass., pp. 119–127 (June 1970)Google Scholar
  26. [PaPe76] Partsch, H., Pepper, P.: A family of rules for recursion removal related to the towers of Hanoi problem. Inf. Process. Lett.5(6), 174–177 (1976)MATHCrossRefMathSciNetGoogle Scholar
  27. [ReNiDe77] Reingold, E.M., Nievergelt, J., Deo, N.: Combinatorial algorithms: Theory and practice. Englewood Cliffs, N.J., Prentice-Hall 1977Google Scholar
  28. [Se83] Sedgewick, R.: Algorithms. Reading, MA: Addison-Wesley 1983MATHGoogle Scholar
  29. [SpLe78] Spitzen, J.M., Levitt, K.N.: An example of hierarchical design and proof. Commun. ACM21(12), 1064–1075 (1978)MATHCrossRefGoogle Scholar
  30. [Vo66] Voroboyov, N.N.: The Fibonacci numbers. Boston, Mass.: D.C. Heath 1966Google Scholar
  31. [We71] Wells, M.B.: Elements of combinatorial computing. London New York: Pergamon Press 1971MATHGoogle Scholar
  32. [Wi82] Williams, J.H.: On the development of the algebra of functional programs. ACM Trans. Program. Languages Systems4(4), 733–757 (1982)MATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag 1990

Authors and Affiliations

  • Hessam Khoshnevisan
    • 1
  1. 1.Department of ComputingImperial College of Science and Technology and MedicineLondonUK

Personalised recommendations