skip to main content
10.1145/1085099.1085104acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Adding constraints to curry via flat guards

Published:29 September 2005Publication History

ABSTRACT

Curry is a functional-logic language provided with a lazy evaluation strategy. This lazy behaviour is achieved, in part, by using a formalism called definitional trees. These trees provide an optimal order for reducing (to some degree) the actual parameters of functions, taking into account the shape of patterns in the left hand sides of their definition. The integration of more and more features of Constraint Programming into Curry should be as orthogonal as possible to existing features. For instance, having a function defined over several cases specified in terms of different constraints should be allowed, in the same way as pattern matching in the functional style is supported. However, this kind of definitions has not been allowed so far, and this is partly due to the absence of an analogue of definitional trees for sets of constraints. This paper reports a first proposal in this direction. A common framework for dealing with lazy pattern matching and constraint handling is presented, in the form of flat guards that can be used to obtain demand information in the same way that data patterns in the rules' left hand sides are currently used. Constraint definitional trees are introduced along with the algorithms needed for its generation from a given function definition. Traditional definitional trees are shown to be an instance of the constraint framework for constraints over algebraic data types. Due to their practical relevance, the case of constraints over numerical (non-algebraic) domains is devoted an specific treatment.

References

  1. Sergio Antoy, Rachid Echahed, and Michael Hanus. A needed narrowing strategy. In Proc. 21st. ACM Symposium on Principles of Programming Languages, pages 268--279, Portland, Oregon, 1994. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Puri Arenas Sánchez, Ana Gil Luezas, and Francisco López Fraguas. Combining lazy narrowing with disequality constraints. In Hermenegildo and Penjam, editors, Programming Language Implementation and Logic Programming, PLILP94, number 844 in LNCS, pages 385--399. Springer, 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. Hanus (ed.), H. Kuchen, and J.J. Moreno-Navarro et al. Curry: An integrated functional logic language. Technical report, RWTH Aachen, 2000.]]Google ScholarGoogle Scholar
  4. Michael Hanus. The integration of functions into logic programming: from theory to practice. Journal of Logic Programming, 19 & 20:583--628, 1994.]]Google ScholarGoogle ScholarCross RefCross Ref
  5. Michael Hanus, Sergio Antoy, Herbert Kuchen, Francisco J. López-Fraguas, Wolfgang Lux, Juan José Moreno-Navarro, and Frank Steiner. Curry: An Integrated Functional Logic Language, 0.8 edition, April 2003. Editor: Michael Hanus.]]Google ScholarGoogle Scholar
  6. M. Hermenegildo, F. Bueno, M. García de la Banda, and G. Puebla. The CIAO multi-dialect compiler and system: An experimentation workbench for future (C)LP systems. In Proceedings of the ILPS'95 Workshop on Visions for the Future of Logic Programming, Portland, Oregon, USA, december 1995. Available from http://www.clip.dia.fi.upm.es/_.]]Google ScholarGoogle Scholar
  7. Joxan Jaffar and Michael J. Maher. Constraint logic programming: A survey. Journal of Logic Programming, 19/20:503--581, 1994.]]Google ScholarGoogle ScholarCross RefCross Ref
  8. Wolfgang Lux. Adding linear constraints over real numbers to curry. In K. Ueda H. Kuchen, editor, Proc. FLOPS 2001, number 2024 in LNCS, pages 185--200. Springer-Verlag, March 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Francisco López Fraguas, Mario Rodríguez Artalejo, and R. del Vado Virseda. A lazy narrowing calculus for declarative constraint programming. In Principles and Practice of Declarative Programming, PPDP2004, pages 43--54. ACM, 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Francisco López Fraguas and Jaime Sánchez Hernández. TOY: A multiparadigm declarative system. In Narendran and Rusinowitz, editors, Rewriting Techniques and Applications, RTA1999, number 1631 in LNCS, pages 244--247. Springer, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Francisco Javier López Fraguas. A general scheme for constraint functional logic programming. In Algebraic and Logic Programming, LNCS. Springer Verlag, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Julio Mariño and José~María Rey. The implementation of Curry via its translation into Prolog. In Kuchen, editor, 7th Workshop on Functional and Logic Programming (WFLP98), number 63 in Working Papers. Westfälische Wilhelms-Universität Münster, 1998.]]Google ScholarGoogle Scholar
  13. Juan José Moreno-Navarro. Expressivity of functional logic languages and their implementation. In R. Barbuti M. Alpuente, editor, Joint Conference on Declarative Programming GULP-PRODE'94. GULP (Italian ALP Chapter), Universidad Politécnica Valencia, Servicio de publicaciones Universidad Politécnica de Valencia, september 1994.]]Google ScholarGoogle Scholar

Index Terms

  1. Adding constraints to curry via flat guards

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in
          • Published in

            cover image ACM Conferences
            WCFLP '05: Proceedings of the 2005 ACM SIGPLAN workshop on Curry and functional logic programming
            September 2005
            78 pages
            ISBN:1595930698
            DOI:10.1145/1085099

            Copyright © 2005 ACM

            Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 29 September 2005

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • Article

            Upcoming Conference

            ICFP '24

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader