Exploiting non-determinism through laziness in guarded functional languages [chapter]

Roland Dietrich, Hendrik C. R. Lock
1991 Lecture Notes in Computer Science  
Guarded Functional Programming is an approach to integrate functional programming, represented by equations and rewriting, and logic programming, represented by Horn clauses and SLD-resolution: the selection of a guarded equation for rewriting an expression is determined by (1) pattern matching with the left hand side and (2) solving the guard which is a Horn logic goal. Besides an introduction to this style of programming, we present an extension of guarded functional programming by the
more » ... of stream comprehensions. The main principle is that, instead of committed choice of one solution, a stream of multiple solutions of a guard is produced lazily. These streams can be consumed in functional expressions. This approach makes it possible to exploit in the functional programming world the non-determinism which is inherent in the logic programming world. Thereby, the deterministic nature of functional programming is maintained, and an efficient implementation is possible through the interleaving of functional and logic computations.
doi:10.1007/3540539816_68 fatcat:xfd3upvxdjbqncvcywy23uwzsi