Skip to main content

Context patterns, part II

  • Conference paper
  • First Online:
Implementation of Functional Languages (IFL 1997)

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

Included in the following conference series:

Abstract

Functional languages allow the definition of functions by pattern matching, which performs an analysis of the structure of values. However, the structures which can be described by such patterns are restricted to a fixed portion from the root of the value.

Context patterns are a new non-local form of patterns, which allow the matching of subterms without fixed distance from the root of the value. Typical applications of context patterns are functions which search a data structure for patterns and transform it by replacing the pattern. In this paper we introduce a new construct called extended context, which allows the definition of transformational functions without superfluous repetition of the recursive search. Furthermore, we present an inference system which formalises the type conditions for context patterns.

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. H. P. Barendregt. The Lambda Calculus: Its Syntax and Semantics, volume 103 of Studies in Logic and The Foundations of Mathematics. North-Holland, 1985.

    Google Scholar 

  2. P. Deransart and J. Małuszyński, editors. Proceedings of the 2nd International Workshop on Programming Language Implementation and Logic Programming (PLILP), number 456 in Lecture Notes in Computer Science. Springer-Verlag, 1990.

    Google Scholar 

  3. D. J. Dougherty and P. Johann. A Combinatory Approach to Higher-Order E-Unification. Theoretical Computer Science, 139(1–2): 207–242, March 1995.

    Article  MATH  MathSciNet  Google Scholar 

  4. M. Erwig. Active Patterns. In Kluge et.al. [12], pages 21—40.

    Google Scholar 

  5. C. Ferdinand. Pattern Matching in a Functional Transformational Language using Treeparsing. In Deransart and Małuszyński [2], pages 358–371.

    Google Scholar 

  6. W. D. Goldfarb. The Undecidability of the Second-Order Unification Problem. Theoretical Computer Science, 13(2): 225–230, February 1981.

    Article  MATH  MathSciNet  Google Scholar 

  7. R. Heckmann. A Functional Language for the Specification of Complex Tree Transformations. In H. Ganzinger, editor, Proceedings of the 2nd European Symposium on Programming (ESOP), number 300 in Lecture Notes in Computer Science, pages 175–190. Springer-Verlag, 1988.

    Google Scholar 

  8. P. Hudak, S. L. Peyton Jones, and P. Wadler et. al. Report on the Programming Language Haskell — A Non-strict, Purely Functional Language. ACM SIGPLAN Notices, 27(4), 1992.

    Google Scholar 

  9. G. Huet. A Unification Algorithm for Typed λ-Calculus. Theoretical Computer Science, 1: 27–57, 1975.

    Article  MATH  MathSciNet  Google Scholar 

  10. G. Huet and B. Lang. Proving and applying Program Transformations Expressed with Second Order Patterns. Acta Informatica, 11: 31–55, 1978.

    Article  MATH  MathSciNet  Google Scholar 

  11. R. J. M. Hughes. A Novel Representation of Lists and Its Application to the Function “reverse”, Information Processing Letters, 22(3): 141–144, March 1986.

    Article  Google Scholar 

  12. W. Kluge et.al., editor. Selected Papers of the 8th International Workshop on Implementation of Functional Languages (IFL), number 1268 in Lecture Notes in Computer Science. Springer-Verlag, 1997.

    Google Scholar 

  13. M. Mohnen. Context Patterns in Haskell. In Kluge et.al. [12], pages 41–58.

    Google Scholar 

  14. M. Mohnen and S. Tobies. Implementing Context Patterns in the Glasgow Haskell Compiler. Technical Report AIB-97-04, RWTH Aachen, 1997.

    Google Scholar 

  15. S. L. Peyton Jones. The Implementation of Functional Programming Languages. Prentice-Hall, 1987.

    Google Scholar 

  16. C. Prehofer. Decidable Higher-order Unification Problems. In A. Bundy, editor, Proceedings of the 12th International Conference on Automated Deduction (CADE), number 814 in Lecture Notes in Computer Science, pages 635–649. Springer-Verlag, 1994.

    Google Scholar 

  17. C. Queinnec. Compilation of Non-Linear, Second Order Patterns on S-Expressions. In Deransart and Maluszynski [2], pages 340–357.

    Google Scholar 

  18. T. Sheard and L. Fegaras. A Fold for All Seasons. In Proceedings of the 6th Conference on Functional Programming Languages and Computer Architecture (FPCA), pages 233–242. ACM, September 1993.

    Google Scholar 

  19. W. Snyder and J. Gallier. Higher Order Unification Revisited: Complete Sets of Tranformations. Journal of Symbolic Computation, 8(1 & 2): 101–140, 1989. Special issue on unification. Part two.

    Article  MATH  MathSciNet  Google Scholar 

  20. V. F. Turchin. Program Transformation by Supercompilation. In H. Ganzinger and N. Jones, editors, Programs as Data Objects, number 217 in Lecture Notes in Computer Science, pages 257–281. Springer-Verlag, 1986.

    Google Scholar 

  21. P. Wadler. Views: A Way for Pattern-matching to Cohabit with Abstraction. In Proceedings of the 14th Symposium on Principles of Programming Languages (POPL), pages 307–313. ACM, January 1987.

    Google Scholar 

  22. R. Wilhelm. Tree Transformations, Functional Languages, and Attribute Grammars. In P. Deransart and M. Jourdan, editors, Attribute Grammars and their Applications, number 461 in LNCS, pages 116–129. Springer-Verlag, 1990.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Chris Clack Kevin Hammond Tony Davie

Rights and permissions

Reprints and permissions

Copyright information

© 1998 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Mohnen, M. (1998). Context patterns, part II. In: Clack, C., Hammond, K., Davie, T. (eds) Implementation of Functional Languages. IFL 1997. Lecture Notes in Computer Science, vol 1467. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0055440

Download citation

  • DOI: https://doi.org/10.1007/BFb0055440

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

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

  • Online ISBN: 978-3-540-68528-9

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics