Teaching functional and logic programming with a single computation model

  • Michael Hanus
Education: Methodologies
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1292)


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.


Functional logic languages lazy evaluation narrowing residuation integration of paradigms 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    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.Google Scholar
  2. 2.
    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.Google Scholar
  3. 3.
    S. Antoy. Definitional Trees. In Proc. of the 3rd International Conference on Algebraic and Logic Programming, pp. 143–157. Springer LNCS 632, 1992.Google Scholar
  4. 4.
    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.Google Scholar
  5. 5.
    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.Google Scholar
  6. 6.
    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.Google Scholar
  7. 7.
    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.Google Scholar
  8. 8.
    M. Hanus. The Integration of Functions into Logic Programming: From Theory to Practice. Journal of Logic Programming, Vol. 19&20, pp. 583–628, 1994.Google Scholar
  9. 9.
    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.Google Scholar
  10. 10.
    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.Google Scholar
  11. 11.
    M. Hanus (ed.). Curry: An Integrated Functional Logic Language. Available at,1997.Google Scholar
  12. 12.
    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.Google Scholar
  13. 13.
    J. Hughes. Why Functional Programming Matters. In D.A. Turner, editor, Research Topcis in Functional Programming, pp. 17–42. Addison Wesley, 1990.Google Scholar
  14. 14.
    J. Jaffar and M.J. Maher. Constraint Logic Programming: A Survey. Journal of Logic Programming, Vol. 19&20, pp. 503–581, 1994.Google Scholar
  15. 15.
    R. Loogen and S. Winkler. Dynamic Detection of Determinism in Functional Logic Languages. Theoretical Computer Science 142, pp. 59–87, 1995.Google Scholar
  16. 16.
    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.Google Scholar
  17. 17.
    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.Google Scholar
  18. 18.
    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.Google Scholar
  19. 19.
    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.Google Scholar
  20. 20.
    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.Google Scholar
  21. 21.
    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.Google Scholar
  22. 22.
    P. Van Hentenryck. Constraint Satisfaction in Logic Programming. MIT Press, 1989.Google Scholar
  23. 23.
    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.Google Scholar
  24. 24.
    D.H.D. Warren. Higher-order extensions to PROLOG: are they needed? In Machine Intelligence 10, pp. 441–454, 1982.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1997

Authors and Affiliations

  • Michael Hanus
    • 1
  1. 1.Informatik IIRWTH AachenAachenGermany

Personalised recommendations