Demand-driven Search in Functional Logic Programs

Michael Hanus and Pierre Réty

Research Report RR-LIFO-98-08, Université d'Orléans, 1998

In this paper we discuss the advantage of lazy functional logic languages to solve search problems. We show that the lazy evaluation strategy of such languages can be easily exploited to implement a solver that explores only the dynamically demanded parts of the search space. In contrast to pure logic programming, the use of non-deterministic functions enables a modular and simple implementation without the risk of floundering. Furthermore, a local encapsulation of search is useful to avoid the combinatorial explosion of the demanded search space. The necessary features (laziness, non-deterministic functions, encapsulated search) are available in Curry, a new declarative language intended to combine functional and logic programming techniques.

We demonstrate the advantage of this approach with a musical application implemented in Curry: the generation of appropriate chords for the accompaniment of a given melody.

Available: PDF BibTeX-Entry

Michael Hanus