Using circular programs to eliminate multiple traversals of data
- 222 Downloads
This paper describes a technique for transforming functional programs that repeatedly traverse a data structure into more efficient alternatives that do not. The transformation makes essential use of lazy evaluation and local recursion (such as provided by letrec, or its equivalent) to build a circular program that, on one pass over the structure, determines the effects of the individual traversals and then combines them.
Unable to display preview. Download preview PDF.
- 1.Bird, R.S.: Programs and Machines — An Introduction to the Theory of Computation. London: John Wiley 1976Google Scholar
- 2.Burstall, R.M., Darlington, J.: A transformation system for developing recursive programs. J. ACM 24, 44–67 (1977)Google Scholar
- 3.Burstall, R.M., Macqueen, D.B., Sannella, D.T.: HOPE: an experimental applicative language. Int Res Report. Dept Computer Science, University of Edinburgh 1980Google Scholar
- 4.Feather, M.: A system for assisting program transformation. ACM Trans Progr. Lang. Syst. 4, 1–20 (1982)Google Scholar
- 5.Henderson, P.: Functional Programming: Application and Implementation. Englewood Cliffs: Prentice-Hall 1980Google Scholar
- 6.Hughes, R.J.M.: The Design and Implementation of Programming Languages. D. Phil. Thesis. Oxford University 1983Google Scholar
- 7.Kott, L.: About a transformation system: a theoretical study. Proc. Third Symp. Progr. Paris, 1971Google Scholar
- 8.Turner, D.: Recursion equations as a programming language. In: Functional Programming and its Applications (Darlington, J., Henderson, P., Turner, D. (eds.). Cambridge: University Press, 1982Google Scholar
- 9.Wadler, P.: (personal communication)Google Scholar
- 10.Wadler, P.: Listlessness is better than laziness. Ph. D. Thesis, Carnegie-Mellon University, 1984Google Scholar