Skip to main content

Adding equations to NU-Prolog

  • Session: Functional And Logic Programming
  • Conference paper
  • First Online:
Programming Language Implementation and Logic Programming (PLILP 1991)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 528))

Abstract

This paper describes an extension to NU-Prolog which allows evaluable functions to be defined using equations. We consider it to be the most pragmatic way of combining functional and relational programming. The implementation consists of several hundred lines of Prolog code and the underlying Prolog implementation was not modified at all. However, the system is reasonably efficient and supports coroutining, optional lazy evaluation, higher order functions and parallel execution. Efficiency is gained in several ways. First, we use some new implementation techniques. Second, we exploit some of the unique features of NU-Prolog, though these features are not essential to the implementation. Third, the language is designed so that we can take advantage of implicit mode and determinism information. Although we have not concentrated on the semantics of the language, we believe that our language design decisions and implementation techniques will be useful in the next generation of combined functional and relational languages.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. P.G. Bosco, C. Cecchi, and C. Moiso. Exploiting the full power of logic plus functional programming. In Kenneth A. Bowen and Robert A. Kowalski, editors, Proceedings of the Fifth International Conference/Symposium on Logic Programming, pages 3–17, Seattle, Washington, August 1988.

    Google Scholar 

  2. P.G. Bosco, C. Cecchi, C. Moiso, M. Porta, and G. Sofi. Logic and functional programming on distributed memory architectures. In Proceedings of the Seventh International Conference on Logic Programming, Jerusalem, Israel, June 1990.

    Google Scholar 

  3. M.H.M. Cheng, M.H. van Emden, and B.E. Richards. On warren's method for functional programming in logic. In Proceedings of the Seventh International Conference on Logic Programming, Jerusalem, Israel, June 1990.

    Google Scholar 

  4. J. Darlington, A.J. Field, and H. Pull. The unification of functional and logic languages. In Doug DeGroot and Gary Lindstrom, editors, Logic programming: relations, functions, and equations, pages 37–70. Prentice-Hall, 1985.

    Google Scholar 

  5. Saumya K. Debray and David S. Warren. Detection and optimisation of functional computations in prolog. In Ehud Shapiro, editor, Proceedings of the Third International Conference on Logic Programming, pages 490–504, London, England, July 1986. published as Lecture Notes in Computer Science 225 by Springer-Verlag.

    Google Scholar 

  6. Laurent Fribourg. SLOG: a logic programming language interpreter based on clausal superposition and rewriting. In Proceedings of the Second IEEE Symposium on Logic Programming, pages 172–184, Boston, Massachusetts, July 1985.

    Google Scholar 

  7. Joseph A. Goguen and Jose Meseguer. EQLOG: equality, types, and generic modules for logic programming. In Doug DeGroot and Gary Lindstrom, editors, Logic programming: relations, functions, and equations, pages 295–363. Prentice-Hall, 1985.

    Google Scholar 

  8. Steve Gregory. Parallel logic programming in parlog. Addison-Wesley, Wokingham, England, 1987.

    Google Scholar 

  9. Alan Josephson and Nachum Dershowitz. An implementation of narrowing the RITE way. In Proceedings of the Third IEEE Symposium on Logic Programming, pages 187–197, Salt Lake City, Utah, September 1986.

    Google Scholar 

  10. S. Peyton Jones. The implementation of functional programming languages. Prentice Hall International series in computer science. Prentice Hall, London, 1987.

    Google Scholar 

  11. Lee Naish. Negation and control in Prolog. Number 238 in Lecture Notes in Computer Science. Springer-Verlag, New York, 1986.

    Google Scholar 

  12. Lee Naish. Parallelizing NU-Prolog. In Kenneth A. Bowen and Robert A. Kowalski, editors, Proceedings of the Fifth International Conference/Symposium on Logic Programming, pages 1546–1564, Seattle, Washington, August 1988.

    Google Scholar 

  13. Lee Naish. Adding equations to NU-prolog. Technical Report 91/2, Department of Computer Science, University of Melbourne, Melbourne, Australia, 1990.

    Google Scholar 

  14. Sanjai Narain. A technique for doing lazy evaluation in logic. Journal of Logic Programming, 3(3):259–276, October 1986.

    Google Scholar 

  15. Sanjai Narain. LOG(F): An optimal combination of logic programming, rewriting and lazy evaluation. Ph.d. thesis, Dept. of computer science, UCLA, Los Angeles, CA, 1988.

    Google Scholar 

  16. Uday S. Reddy. Narrowing as the operational semantics of functional languages. In Proceedings of the Second IEEE Symposium on Logic Programming, pages 138–151, Boston, Massachusetts, July 1985.

    Google Scholar 

  17. Yeh-Heng Sheng. HIFUNLOG: logic programming with higher-order relational functions. In Proceedings of the Seventh International Conference on Logic Programming, Jerusalem, Israel, June 1990.

    Google Scholar 

  18. P.A. Subrahmanyam and Jia-Huai You. FUNLOG: a computational model integrating logic programming and functional programming. In Doug DeGroot and Gary Lindstrom, editors, Logic programming: relations, functions, and equations, pages 157–198. Prentice-Hall, 1985.

    Google Scholar 

  19. David H.D. Warren. Higher-order extensions to prolog: are they needed? In J.E. Hayes, Donald Michie, and Y-H. Pao, editors, Machine Intelligence 10, pages 441–454. Ellis Horwood Ltd., Chicester, England, 1982.

    Google Scholar 

  20. David H.D. Warren. An abstract Prolog instruction set. Tecnical Note 309, SRI International, Menlo Park, California, October 1983.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Jan Maluszyński Martin Wirsing

Rights and permissions

Reprints and permissions

Copyright information

© 1991 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Naish, L. (1991). Adding equations to NU-Prolog. In: Maluszyński, J., Wirsing, M. (eds) Programming Language Implementation and Logic Programming. PLILP 1991. Lecture Notes in Computer Science, vol 528. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-54444-5_84

Download citation

  • DOI: https://doi.org/10.1007/3-540-54444-5_84

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-54444-9

  • Online ISBN: 978-3-540-38362-8

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics