Declarative Programming with Function Patterns

  • Sergio Antoy
  • Michael Hanus
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3901)

Abstract

We propose an extension of functional logic languages that allows the definition of operations with patterns containing other defined operation symbols. Such “function patterns” have many advantages over traditional constructor patterns. They allow a direct representation of specifications as declarative programs, provide better abstractions of patterns as first-class objects, and support the high-level programming of queries and transformation of complex structures. Moreover, they avoid known problems that occur in traditional programs using strict equality. We define their semantics via a transformation into standard functional logic programs. Since this transformation might introduce an infinite number of rules, we suggest an implementation that can be easily integrated with existing functional logic programming systems.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Albert, E., Hanus, M., Huch, F., Oliver, J., Vidal, G.: Operational Semantics for Declarative Multi-Paradigm Languages. Journal of Symbolic Computation 40(1), 795–829 (2005)MATHCrossRefMathSciNetGoogle Scholar
  2. 2.
    Alpuente, M., Falaschi, M., Vidal, G.: Partial Evaluation of Functional Logic Programs. ACM Transactions on Programming Languages and Systems 20(4), 768–844 (1998)CrossRefGoogle Scholar
  3. 3.
    Antoy, S.: Optimal Non-Deterministic Functional Logic Computations. In: Hanus, M., Heering, J., Meinke, K. (eds.) ALP 1997 and HOA 1997. LNCS, vol. 1298, pp. 16–30. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  4. 4.
    Antoy, S.: Constructor-based Conditional Narrowing. In: Proc. of the 3rd International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP 2001), pp. 199–206. ACM Press, New York (2001)CrossRefGoogle Scholar
  5. 5.
    Antoy, S.: Evaluation Strategies for Functional Logic Programming. Journal of Symbolic Computation 40(1), 875–903 (2005)MATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    Antoy, S., Echahed, R., Hanus, M.: A Needed Narrowing Strategy. Journal of the ACM 47(4), 776–822 (2000)CrossRefMathSciNetGoogle Scholar
  7. 7.
    Antoy, S., Hanus, M.: Compiling Multi-Paradigm Declarative Programs into Prolog. In: Kirchner, H. (ed.) FroCos 2000. LNCS, vol. 1794, pp. 171–185. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  8. 8.
    Antoy, S., Hanus, M.: Functional Logic Design Patterns. In: Hu, Z., Rodríguez-Artalejo, M. (eds.) FLOPS 2002. LNCS, vol. 2441, pp. 67–87. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  9. 9.
    Baader, F., Nipkow, T.: Term Rewriting and All That. Cambridge University Press, Cambridge (1998)Google Scholar
  10. 10.
    Dershowitz, N., Jouannaud, J.-P.: Rewrite Systems. In: van Leeuwen, J. (ed.) Handbook of Theoretical Computer Science, vol. B, pp. 243–320. Elsevier, Amsterdam (1990)Google Scholar
  11. 11.
    Erwig, M., Peyton Jones, S.: Pattern Guards and Transformational Patterns. Electronic Notes in Theoretical Computer Science 41(1) (2000)Google Scholar
  12. 12.
    Fribourg, L.: SLOG: A Logic Programming Language Interpreter Based on Clausal Superposition and Rewriting. In: Proc. IEEE Internat. Symposium on Logic Programming, Boston, pp. 172–184 (1985)Google Scholar
  13. 13.
    Giovannetti, E., Levi, G., Moiso, C., Palamidessi, C.: Kernel LEAF: A Logic plus Functional Language. Journal of Computer and System Sciences 42(2), 139–185 (1991)MATHCrossRefGoogle Scholar
  14. 14.
    González-Moreno, J.C., Hortalá-González, M.T., López-Fraguas, F.J., Rodríguez-Artalejo, M.: An approach to declarative programming based on a rewriting logic. Journal of Logic Programming 40, 47–87 (1999)MATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    Hanus, M.: Compiling Logic Programs with Equality. In: Deransart, P., Małuszyński, J. (eds.) PLILP 1990. LNCS, vol. 456, pp. 387–401. Springer, Heidelberg (1990)CrossRefGoogle Scholar
  16. 16.
    Hanus, M.: The Integration of Functions into Logic Programming: From Theory to Practice. Journal of Logic Programming 19, 20, 583–628 (1994)CrossRefMathSciNetGoogle Scholar
  17. 17.
    Hanus, M.: 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
  18. 18.
    Hanus, M.: A Functional Logic Programming Approach to Graphical User Interfaces. In: Pontelli, E., Santos Costa, V. (eds.) PADL 2000. LNCS, vol. 1753, pp. 47–62. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  19. 19.
    Hanus, M.: High-Level Server Side Web Scripting in Curry. In: Ramakrishnan, I.V. (ed.) PADL 2001. LNCS, vol. 1990, pp. 76–92. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  20. 20.
    Hanus, M., Antoy, S., Engelke, M., Höppner, K., Koj, J., Niederau, P., Sadre, R., Steiner, F.: PAKCS: The Portland Aachen Kiel Curry System (2004), available at http://www.informatik.uni-kiel.de/~pakcs/
  21. 21.
    Hanus, M., Steiner, F.: Controlling Search in Declarative Programs. In: Palamidessi, C., Meinke, K., Glaser, H. (eds.) ALP 1998 and PLILP 1998. LNCS, vol. 1490, pp. 374–390. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  22. 22.
    Hanus, M. (ed.): Curry: An Integrated Functional Logic Language (Vers.0.8) (2003), available at http://www.informatik.uni-kiel.de/~curry
  23. 23.
    Jaffar, J., Lassez, J.-L.: Constraint Logic Programming. In: Proc. of the 14th ACM Symposium on Principles of Programming Languages, Munich, pp. 111–119 (1987)Google Scholar
  24. 24.
    Lämmel, R., Peyton Jones, S.L.: Scrap your boilerplate: a practical design pattern for generic programming. In: Proceedings of the 2003 ACM SIGPLAN International Workshop on Types in Languages Design and Implementation (TLDI 2003), pp. 26–37. ACM Press, New York (2003)CrossRefGoogle Scholar
  25. 25.
    López-Fraguas, F., Sánchez-Hernández, J.: TOY: A Multiparadigm Declarative System. In: Narendran, P., Rusinowitch, M. (eds.) RTA 1999. LNCS, vol. 1631, pp. 244–247. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  26. 26.
    Mohnen, M.: Context Patterns in Haskell. In: Kluge, W. (ed.) IFL 1996. LNCS, vol. 1268, pp. 41–57. Springer, Heidelberg (1997)Google Scholar
  27. 27.
    Peyton Jones, S. (ed.): Haskell 98 Language and Libraries—The Revised Report. Cambridge University Press, Cambridge (2003)Google Scholar
  28. 28.
    Tullsen, M.: First class patterns. In: Pontelli, E., Santos Costa, V. (eds.) PADL 2000. LNCS, vol. 1753, pp. 1–15. Springer, Heidelberg (2000)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Sergio Antoy
    • 1
  • Michael Hanus
    • 2
  1. 1.Computer Science Dept.Portland State UniversityOregonUSA
  2. 2.Institut für Informatik, CAU KielKielGermany

Personalised recommendations