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’.
Preview
Unable to display preview. Download preview PDF.
References
M. Bellia, G. Levi: The Relation between Logic and Functional Languages, Journal of Logic Progr., Vol. 3, 1986, 217–236.
P. G. Bosco, E. Giovannetti: IDEAL: An Ideal Deductive Applicative Language, IEEE Symp. on Logic Progr. 1986, IEEE Comp. Soc. Press, 89–94.
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.
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.
D. DeGroot, G. Lindstrom (eds.): Logic Programming: Functions, Relations, Equations, Prentice Hall 1986.
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.
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.
M. Hanus: Compiling Logic Programs with Equality, Workshop on Progr. Language Impl. and Logic Progr. (PLILP) 1990, LNCS 456, Springer Verlag 1990, 387–401.
P. Hudak, P. Wadler: Report on the Functional Programming Language Haskell, SIG-PLAN Notices, Vol. 27, No. 5, May 1992.
P. J. Landin: The Mechanical Evaluation of Expressions, Computer Journal, 6, 4, 1964.
R. Loogen: From Reduction Machines to Narrowing Machines, TAPSOFT 1991, LNCS 494, Springer Verlag 1991, 438–457.
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.
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.
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.
S. Peyton Jones: The Implementation of Functional Programming Languages, Prentice Hall 1987.
U. S. Reddy: Narrowing as the Operational Semantics of Functional Languages, IEEE Symp. on Logic Progr., IEEE Computer Society Press 1985, 138–151.
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.
D. H. D. Warren: An Abstract Prolog Instruction Set, Technical Note 309, SRI International, Menlo Park, California, October 1983.
Author information
Authors and Affiliations
Corresponding author
Editor information
Rights 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