How to Use Guarded Functional Programming
Guarded functional programming (GFP) has been proposed as an approach to integrate functional programming, represented by equations and rewriting, and logic programming, represented by Horn clauses and SLD resolution. The basic programming constructs are guarded equations, i.e. equations conditioned by guards which are Horn logic goals. When an equation is applied to rewrite an expression, its guard must be solved first. If a guard has more than one solutions, only one is considered (committed choice). In an extension of GFP, list comprehensions can be used to collect all solutions of a goal (GFP*). This paper presents a systematic approach how to use GFP* with respect to a classification of functions and relations regarding non-determinism properties. A sample problem is described whereof a taxonomy of functions and relations is derived. It is shown how the programming constructs of GFP* reflect this taxonomy and a systematic solution of the sample problem is outlined.
KeywordsInference System Inference Rule Logic Programming Sample Problem Functional Programming
Unable to display preview. Download preview PDF.
- [Cha91]M. M. T. Chakravarty. Die funktional logische Programmiersprache Guarded termml: Sprachdefinition. Technical report, GMD Research Laboratory Karlsruhe, May 1991.Google Scholar
- [Die90]R. Dietrich. Vergleichende Analyse von Inferenzsystemen. GMD-Bericht Nr. 188. R. Oldenbourg Verlag, 1990.Google Scholar
- [Die91]R. Dietrich. The PHOENIX case study: EXIS - an environment for experimenting with inference systems. GMD-Studie Nr. 190, April 1991.Google Scholar
- [DL91]R. Dietrich and H. C. R. Lock. Exploiting non-determinism through laziness in guarded functional languages. In TAPSOFT’91, Colloquium on Combining Paradigms for Software Development, Brighton, England, April 1991.Google Scholar
- [DP91]R. Dietrich and H. Pull. Case studies in declarative programming. GMD Forschungsstelle Karlsruhe and Imperial College, London, PHOENIX-Deliverable A. 2. 1, March 1991.Google Scholar
- [Dra87]W. Drabent. Do logic programs resemble conventional programs. In 4th IEEE Symposium on Logic Programming, San Francisco, pages 389–397, 1987.Google Scholar
- [GL90]Yi-Ke Guo and H. C. R. Lock. A Classification Scheme for Declarative Programming Languages. - Syntax, Semantics, and Operational Models. GMD-Studien Nr. 182, August 1990.Google Scholar
- Loc88] Hendrik C.R. Lock. Guarded Term ML. In Workshop on Implementations of Lazy. Functional Languages,Aspenas, Sept. 1988. Report 53, PMG, Univ. of Goteborg, Sweden.Google Scholar
- MMTC91] H. C. R. Lock M. M. T. Chackravarty. The Implementation of Lazy Narrowing. In Programming Language Implementation and Logic Programming (PLILP’91), Passau,August 1991. Springer LNCS (to appear).Google Scholar
- [Ni182]N. J. Nilsson. Principles of Artificial Intelligence. Springer, 1982.Google Scholar