Chapter

Functional and Logic Programming

Volume 3945 of the series Lecture Notes in Computer Science pp 146-162

A Syntactic Approach to Combining Functional Notation, Lazy Evaluation, and Higher-Order in LP Systems

  • Amadeo CasasAffiliated withDepts. of Comp. Science and Electr. and Comp. Eng., Univ. of New Mexico
  • , Daniel CabezaAffiliated withSchool of Computer Science, T.U. Madrid (UPM)
  • , Manuel V. HermenegildoAffiliated withDepts. of Comp. Science and Electr. and Comp. Eng., Univ. of New MexicoSchool of Computer Science, T.U. Madrid (UPM)

* Final gross prices may vary according to local VAT.

Get Access

Abstract

Nondeterminism and partially instantiated data structures give logic programming expressive power beyond that of functional programming. However, functional programming often provides convenient syntactic features, such as having a designated implicit output argument, which allow function call nesting and sometimes results in more compact code. Functional programming also sometimes allows a more direct encoding of lazy evaluation, with its ability to deal with infinite data structures. We present a syntactic functional extension, used in the Ciao system, which can be implemented in ISO-standard Prolog systems and covers function application, predefined evaluable functors, functional definitions, quoting, and lazy evaluation. The extension is also composable with higher-order features and can be combined with other extensions to ISO-Prolog such as constraints. We also highlight the features of the Ciao system which help implementation and present some data on the overhead of using lazy evaluation with respect to eager evaluation.

Keywords

Declarative Languages Logic Functional and Logic- Functional Programming Lazy Evaluation Higher Order