Skip to main content

On the interaction of lazy evaluation and backtracking

  • Conference paper
  • First Online:
Programming Language Implementation and Logic Programming (PLILP 1992)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 631))

Abstract

We investigate the interaction of lazy evaluation and backtracking in the framework of functional logic languages, whose operational semantics is based on lazy narrowing. Technically, it is no problem to realize a lazy narrowing strategy by adapting the well-known techniques, which have been developed for functional languages, to the more general evaluation mechanism of functional logic languages. But, unfortunately, it turns out, that the use of a lazy strategy has some severe disadvantages. In particular, it may lead to nontermination in combination with backtracking, where an innermost strategy will determine a solution. The use of demandedness information for function arguments allows us to define a mixture between an eager and a lazy evaluation strategy, which partially helps to cope with these problems. The runtimes obtained for various example programs with respect to the different strategies, substantiate that the mixed strategy is a reasonable compromise between an eager and a lazy strategy for functional logic languages.

The authors are supported by the grant In 20/6-1 from the ‘Deutsche Forschungsgemeinschaft’.

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

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. M. Bellia, G. Levi: The Relation between Logic and Functional Languages, Journal of Logic Progr., Vol. 3, 1986, 217–236.

    Google Scholar 

  2. P. G. Bosco, E. Giovannetti: IDEAL: An Ideal Deductive Applicative Language, IEEE Symp. on Logic Progr. 1986, IEEE Comp. Soc. Press, 89–94.

    Google Scholar 

  3. P. G. Bosco, C. Cecchi, C. Moiso: An extension of WAM for K-LEAF: A WAM-based compilation of conditional narrowing, Conf. on Logic Progr. 1989, MIT Press 1989, 318–333.

    Google Scholar 

  4. M. M. T. Chakravarty, H. C. R. Lock: The Implementation of Lazy Implementation, Symp. on Progr. Language Impl. and Logic Progr. (PLILP) 1991, LNCS 528, Springer Verlag 1991, 123–134.

    Google Scholar 

  5. D. DeGroot, G. Lindstrom (eds.): Logic Programming: Functions, Relations, Equations, Prentice Hall 1986.

    Google Scholar 

  6. J. Fairbairn, St. Wray: TIM: A Simple, Lazy Abstract Machine to Execute Supercombinators, Conf. on Func. Progr. Languages and Computer Arch. 1987, LNCS 274, Springer Verlag 1987, 34–45.

    Google Scholar 

  7. L. Fribourg: SLOG: A Logic Programming Language Interpreter Based on Clausal Superposition and Rewriting, IEEE Symp. on Logic Progr. 1985, IEEE Computer Society Press 1985, 172–184.

    Google Scholar 

  8. M. Hanus: Compiling Logic Programs with Equality, Workshop on Progr. Language Impl. and Logic Progr. (PLILP) 1990, LNCS 456, Springer Verlag 1990, 387–401.

    Google Scholar 

  9. P. Hudak, P. Wadler: Report on the Functional Programming Language Haskell, SIG-PLAN Notices, Vol. 27, No. 5, May 1992.

    Google Scholar 

  10. P. J. Landin: The Mechanical Evaluation of Expressions, Computer Journal, 6, 4, 1964.

    Google Scholar 

  11. R. Loogen: From Reduction Machines to Narrowing Machines, TAPSOFT 1991, LNCS 494, Springer Verlag 1991, 438–457.

    Google Scholar 

  12. R. Loogen, St. Winkler: Dynamic Detection of Determinism in Functional Logic Languages, Symp. on Progr. Language Impl. and Logic Progr. (PLILP) 1991, LNCS 528, Springer Verlag 1991, 335–346.

    Google Scholar 

  13. J. J. Moreno-Navarro, M. Rodríguez-Artalejo: Logic Programming with Functions and Predicates: The Language BABEL, Journal of Logic Progr., Vol. 12, North Holland 1992, 191–223.

    Google Scholar 

  14. J. J. Moreno-Navarro, H. Kuchen, R. Loogen, M. Rodríguez-Artalejo: Lazy Narrowing in a Graph Machine, Conf. on Algebraic and Logic Progr. 1990, LNCS 463, Springer Verlag 1990, 298–317.

    Google Scholar 

  15. S. Peyton Jones: The Implementation of Functional Programming Languages, Prentice Hall 1987.

    Google Scholar 

  16. U. S. Reddy: Narrowing as the Operational Semantics of Functional Languages, IEEE Symp. on Logic Progr., IEEE Computer Society Press 1985, 138–151.

    Google Scholar 

  17. D. Turner: Miranda: A non-strict functional language with polymorphic types, Conf. on Func. Progr. Lang. and Computer Arch. 1985, LNCS 201, Springer Verlag 1985, 1–16.

    Google Scholar 

  18. D. H. D. Warren: An Abstract Prolog Instruction Set, Technical Note 309, SRI International, Menlo Park, California, October 1983.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Rita Loogen .

Editor information

Maurice Bruynooghe Martin Wirsing

Rights and permissions

Reprints and permissions

Copyright information

© 1992 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Hans, W., Loogen, R., Winkler, S. (1992). On the interaction of lazy evaluation and backtracking. In: Bruynooghe, M., Wirsing, M. (eds) Programming Language Implementation and Logic Programming. PLILP 1992. Lecture Notes in Computer Science, vol 631. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-55844-6_147

Download citation

  • DOI: https://doi.org/10.1007/3-540-55844-6_147

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-55844-6

  • Online ISBN: 978-3-540-47297-1

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics