Abstract
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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
M. M. T. Chakravarty. Die funktional logische Programmiersprache Guarded termml: Sprachdefinition. Technical report, GMD Research Laboratory Karlsruhe, May 1991.
R. Dietrich. Vergleichende Analyse von Inferenzsystemen. GMD-Bericht Nr. 188. R. Oldenbourg Verlag, 1990.
R. Dietrich. The PHOENIX case study: EXIS - an environment for experimenting with inference systems. GMD-Studie Nr. 190, April 1991.
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.
R. Dietrich and H. Pull. Case studies in declarative programming. GMD Forschungsstelle Karlsruhe and Imperial College, London, PHOENIX-Deliverable A. 2. 1, March 1991.
W. Drabent. Do logic programs resemble conventional programs. In 4th IEEE Symposium on Logic Programming, San Francisco, pages 389–397, 1987.
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.
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.
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).
N. J. Nilsson. Principles of Artificial Intelligence. Springer, 1982.
J. A. Robinson. A machine oriented logic based on the resolution principle. JACM, 12, No. 1: 23–41, January 1965.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1992 Springer-Verlag London
About this paper
Cite this paper
Dietrich, R. (1992). How to Use Guarded Functional Programming. In: Darlington, J., Dietrich, R. (eds) Declarative Programming, Sasbachwalden 1991. Workshops in Computing. Springer, London. https://doi.org/10.1007/978-1-4471-3794-8_3
Download citation
DOI: https://doi.org/10.1007/978-1-4471-3794-8_3
Publisher Name: Springer, London
Print ISBN: 978-3-540-19735-5
Online ISBN: 978-1-4471-3794-8
eBook Packages: Springer Book Archive