Improving Functional Logic Programs by Difference-Lists
Modern multi-paradigm declarative languages integrate features from functional, logic, and concurrent programming. Since programs in these languages make extensive use of list-processing functions, we consider of much interest the development of list-processing optimization techniques. In this work, we consider the adaptation of the well-known difference-lists transformation from the logic programming paradigm to our integrated setting. Unfortunately, the use of differencelists is impractical due to the absence of non-strict equality in lazy (callby-name) languages. Despite all, we have developed a novel, stepwise transformation which achieves a similar effect over functional logic programs. We also show a simple and practical approach to incorporate the optimization into a real compiler. Finally, we have conducted a number of experiments which show the practicality of our proposal.
Keywordsfunctional logic programming program transformation compiler optimization
Unable to display preview. Download preview PDF.
- 1.E. Albert, C. Ferri, F. Steiner, and G. Vidal. List-Processing Optimizations in a Multi-Paradigm Declarative Language. Technical Report DSIC, UPV, 2000. Available from URL: http://www.dsic.upv.es/users/elp/papers.html.
- 2.M. Alpuente, M. Falaschi, G. Moreno, and G. Vidal. A Transformation System for Lazy Functional Logic Programs. In A. Middeldorp and T. Sato, editors, Proc. of FLOPS’99, pages 147–162. Springer LNCS 1722, 1999.Google Scholar
- 3.S. Antoy. Definitional trees. In Proc. of the 3rd Int’l Conference on Algebraic and Logic Programming, ALP’92, pages 143–157. Springer LNCS 632, 1992.Google Scholar
- 5.N. Dershowitz and J.-P. Jouannaud. Rewrite Systems. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, volume B: Formal Models and Semantics, pages 243–320. Elsevier, Amsterdam, 1990.Google Scholar
- 6.A. J. Gill, J. Launchbury, and S. L. Peyton Jones. A Short Cut to Deforestation. In Proc. of FPLCA’93, pages 223–232, New York, NY (USA), 1993. ACM Press.Google Scholar
- 8.M. Hanus, S. Antoy, J. Koj, P. Niederau, R. Sadre, and F. Steiner. PAKCS 1.2: User Manual. Technical report, CAU Kiel, 2000. Available at http://www.informatik.uni-kiel.de/~pakcs.
- 9.M. Hanus (ed.). Curry: An Integrated Functional Logic Language. Available at http://www.informatik.uni-kiel.de/~curry, 2000.
- 10.G. Huet and J. J. Lévy. Computations in orthogonal rewriting systems, Part I + II. In J. L. Lassez and G. D. Plotkin, editors, Computational Logic — Essays in Honor of Alan Robinson, pages 395–443, 1992.Google Scholar
- 11.J. Hughes. A Novel representation of Lists and its Application to the Function reverse. Tech. Report PMG-38, Chalmers Institute of Technology, Sweden, 1984.Google Scholar
- 12.K. Marriott and H. Søndergaard. Difference-list Transformation for Prolog. New Generation Computing, 11(2):125–157, October 1993.Google Scholar
- 13.L. Sterling and E. Shapiro. The Art of Prolog: Advanced Programming Techniques. MIT Press, 1986.Google Scholar
- 14.H. Tamaki and T. Sato. Unfold/Fold Transformations of Logic Programs. In Proc. of Second Int’l Conf. on Logic Programming, pages 127–139, 1984.Google Scholar
- 15.P. L. Wadler. The Concatenate Vanishes. Technical report, Department of Computing Science, University of Glasgow, UK, 1987.Google Scholar