Abstract
Functional and logic programming are often taught in different courses so that students often do not understand the relationships between these declarative programming paradigms. This is mainly due to the different underlying computation models—deterministic reduction and lazy evaluation in functional languages, and non-deterministic search in logic languages. We show in this paper that this need not be the case. Taking into account recent developments in the integration of functional and logic programming, it is possible to teach the ideas of modern functional languages like Haskell and logic programming on the basis of a single computation model. From this point of view, logic programming is considered as an extension of functional programming where ground expressions are extended to contain also free variables. We describe this computation model, the structure of a course based on it, and draw some conclusions from the experiences with such a course.
Preview
Unable to display preview. Download preview PDF.
References
H. Alt-Kaci, P. Lincoln, and R. Nasr. Le Fun: Logic, equations, and Functions. In Proc. 4th IEEE Internat. Symposium on Logic Programming, pp. 17–23, 1987.
H. Aït-Kaci and A. Podelski. Functions as Passive Constraints in LIFE. ACM Transactions on Programming Languages and Systems, Vol. 16, No. 4, pp. 1279–1318, 1994.
S. Antoy. Definitional Trees. In Proc. of the 3rd International Conference on Algebraic and Logic Programming, pp. 143–157. Springer LNCS 632, 1992.
S. Antoy, R. Echahed, and M. Hanus. A Needed Narrowing Strategy. In Proc. 21st ACM Symposium on Principles of Programming Languages, pp. 268–279, Portland, 1994.
S. Antoy, R. Echahed, and M. Hanus. Parallel Evaluation Strategies for Functional Logic Languages. In Proc. of the Fourteenth International Conference on Logic Programming (ICLP'97). MIT Press (to appear), 1997.
S. Bonnier and J. Maluszynski. Towards a Clean Amalgamation of Logic Programs with External Procedures. In Proc. 5th Conference on Logic Programming \(\&\) 5th Symposium on Logic Programming (Seattle), pp. 311–326. MIT Press, 1988.
N. Dershowitz and J.-P. Jouannaud. Rewrite Systems. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, Vol. B, pp. 243–320. Elsevier, 1990.
M. Hanus. The Integration of Functions into Logic Programming: From Theory to Practice. Journal of Logic Programming, Vol. 19&20, pp. 583–628, 1994.
M. Hanus. A Unified Computation Model for Functional and Logic Programming. In Proc. of the 24th ACM Symposium on Principles of Programming Languages (Paris), pp. 80–93, 1997.
M. Hanus and C. Prehofer.Higher-Order Narrowing with Definitional Trees. In Proc. Seventh International Conference on Rewriting Techniques and Applications (RTA'96), pp. 138–152. Springer LNCS 1103, 1996.
M. Hanus (ed.). Curry: An Integrated Functional Logic Language. Available at http://www-i2.informatik.rwth-aachen.de/~hanus/curry,1997.
G. Huet and J.-J. Lévy. Computations in Orthogonal Rewriting Systems. In J. L. Lassez and G. Plotkin, editors, Computational Logic: Essays in Honor of Alan Robinson, pp. 395–443. MIT Press, 1991.
J. Hughes. Why Functional Programming Matters. In D.A. Turner, editor, Research Topcis in Functional Programming, pp. 17–42. Addison Wesley, 1990.
J. Jaffar and M.J. Maher. Constraint Logic Programming: A Survey. Journal of Logic Programming, Vol. 19&20, pp. 503–581, 1994.
R. Loogen and S. Winkler. Dynamic Detection of Determinism in Functional Logic Languages. Theoretical Computer Science 142, pp. 59–87, 1995.
J.J. Moreno-Navarro and M. RodrĂguez-Artalejo. Logic Programming with Functions and Predicates: The Language BABEL. Journal of Logic Programming, Vol. 12, pp. 191–223, 1992.
L. Naish. Higher-order logic programming in Prolog. In Proc. JICSLP'96 Workshop on Multi-Paradigm Logic Programming, pp. 167–176. TU Berlin, Technical Report No. 96-28, 1996.
S.L. Peyton Jones and P. Wadler. Imperative Functional Programming. In Proc. 20th Symposium on Principles of Programming Languages (POPL'93), pp. 71–84, 1993.
R.C. Sekar and I.V. Ramakrishnan. Programming in Equational Logic: Beyond Strong Sequentiality. Information and Computation, Vol. 104, No. 1, pp. 78–109, 1993.
E. Shapiro and A. Takeuchi. Object Oriented Programming in Concurrent Prolog. In E. Shapiro, editor, Concurrent Prolog: Collected Papers, volume 2, pp. 251–273. MIT Press, 1987.
G. Smolka. The Oz Programming Model. In J. van Leeuwen, editor, Computer Science Today: Recent Trends and Developments, pp. 324–343. Springer LNCS 1000, 1995.
P. Van Hentenryck. Constraint Satisfaction in Logic Programming. MIT Press, 1989.
P. Wadler. Efficient Compilation of Pattern-Matching. In S.L. Peyton Jones, editor, The Implementation of Functional Programming Languages, pp. 78–103. Prentice Hall, 1987.
D.H.D. Warren. Higher-order extensions to PROLOG: are they needed? In Machine Intelligence 10, pp. 441–454, 1982.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1997 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Hanus, M. (1997). Teaching functional and logic programming with a single computation model. In: Glaser, H., Hartel, P., Kuchen, H. (eds) Programming Languages: Implementations, Logics, and Programs. PLILP 1997. Lecture Notes in Computer Science, vol 1292. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0033854
Download citation
DOI: https://doi.org/10.1007/BFb0033854
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-63398-3
Online ISBN: 978-3-540-69537-0
eBook Packages: Springer Book Archive