## Context Patterns, Part II (1997)

Venue: | In Implementation of Functional Languages |

Citations: | 2 - 0 self |

### BibTeX

@INPROCEEDINGS{Mohnen97contextpatterns,,

author = {Markus Mohnen},

title = {Context Patterns, Part II},

booktitle = {In Implementation of Functional Languages},

year = {1997},

pages = {338--357}

}

### OpenURL

### 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 the root of the value. Context patterns are a new nonlocal 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.

### Citations

536 | The Implementation of Functional Programming Languages - JONES, L - 1987 |

287 |
The Lambda Calculus: Its Syntax and Semantics, volume 103
- Barendregt
- 1984
(Show Context)
Citation Context ...ue v if there exists a function f and values v 1 ; : : : ; v k such that pat i matches v i and f v 1 : : : v k is equal to v. Furthermore, this function f is a representation of a constructor context =-=[Bar85]-=-, i.e. a constructor term with iholesj. The representation consists of modelling the iholej by the function arguments: f = h 1 : : : : h k :C[h 1 ; : : : ; h k ] where C is a constructor context with ... |

169 |
A unification algorithm for typed -calculus
- Huet
- 1975
(Show Context)
Citation Context ... terms and equations, this problem becomes decidable [Pre94]. Especially in our case, where only the pattern can contain unbound variables, i.e. uni��cation becomes matching, the problem is decida=-=ble [Hue75]-=-. The representation of context by functions are related to [Hug86], where lists of type [a] are represented by a function of type [a]-?[a]. Given a list l, the representation is obtained by append l.... |

148 |
Proving and applying program transformations expressed with second-order patterns
- Huet, Lang
- 1978
(Show Context)
Citation Context ...s for lists, and allow nonlinear patterns, which may interfere with lazy evaluation [Pey87, p. 65]. Pattern matching usually results in a list of solutions. An even more general approach was taken in =-=[HL78] whe-=-re secondorder schemes are used to describe transformation rules. These allow the speci��cation and selection of arbitrary subtrees but are not integrated in a functional language. The language Re... |

142 | Views: a way for pattern matching to cohabit with data abstraction
- Wadler
(Show Context)
Citation Context ...ttern matching is to use unfree data types, where the matching or a pattern is done by evaluation of a usedde��ned function. Dioeerent approaches based on this idea are Miranda's laws, Wadler's vi=-=ews [Wad87], and Er-=-wig's active patterns [Erw97]. Another root of our work can be seen in higherorder uni��cation [Hue75, SG89, DJ95]. The general approach is to synthesise terms in order to ��nd bindings for fr... |

16 |
Program Transformation by Supercompilation
- Turchin
- 1986
(Show Context)
Citation Context ...re secondorder schemes are used to describe transformation rules. These allow the speci��cation and selection of arbitrary subtrees but are not integrated in a functional language. The language Re=-=fal [Tur86]-=- which is used a the basis for supercompilation has strings as data structure and allows patterns like s 1 e x s 1 where s 1 is a string and e x is a character. In [Que90] patterns with segment assign... |

11 |
Report on the programming Language Haskell - A non-strict, Purely Functional Language - version 1.0
- al
- 1990
(Show Context)
Citation Context ...bindings, list comprehensions, and case expressions. However, the ��rst four of these can be translated into case expressions, so we only consider patterns in case expressions. Furthermore, we fol=-=low [HPW92]-=- and assume that we have a context pattern in a simple case expression: case e 0 --c p 1 if g 1 : : : pn if g n -? e ;s-? e 0 For the topdown lefttoright traversal of a value e 0 , we have to visit ev... |

9 | Context patterns in Haskell
- Mohnen
- 1996
(Show Context)
Citation Context ... context, which allows the de��nition of transformational functions without superAEuous repetition of the recursive search. 1 Introduction This paper is the successor to iContext Patterns in Haske=-=llj [Moh97]. Th-=-at work described a new nonlocal kind of pattern which allows matching of subterms without ��xed distance from the root of the value. The underlying observation is that standard patterns allow onl... |

8 | Compilation of Non-Linear, Second Order Patterns on S-Expressions
- Queinnec
- 1990
(Show Context)
Citation Context ...language. The language Refal [Tur86] which is used a the basis for supercompilation has strings as data structure and allows patterns like s 1 e x s 1 where s 1 is a string and e x is a character. In =-=[Que90]-=- patterns with segment assignments and their compilation are studied in the context of Lisp. The segments allow the access to parts of a matched list, e.g. the pattern (?x ??y ?x) matches all lists wh... |

5 | Tree Transformations, Functional Languages, and Attribute Grammars - Wilhelm - 1990 |

3 | Pattern Matching in a Functional Transformational Language using Treeparsing - Ferdinand - 1990 |

3 |
Decidable Higher-order Uni��cation Problems
- Prehofer
- 1994
(Show Context)
Citation Context ...cations, such that equations fireduce to equal terms. In general, this problem is undecidable [Gol81]. However, for certain subclasses of generated terms and equations, this problem becomes decidable =-=[Pre94]. Es-=-pecially in our case, where only the pattern can contain unbound variables, i.e. uni��cation becomes matching, the problem is decidable [Hue75]. The representation of context by functions are rela... |

3 | Higher order unication revisited: Complete sets of tranformations - Snyder, Gallier - 1989 |

2 | A Combinatory Approach to Higher-Order EUni��cation - Dougherty, Johann - 1995 |

2 |
The Undecidability of the Second-Order Uni��cation Problem
- Goldfarb
- 1981
(Show Context)
Citation Context ... The general approach is to synthesise terms in order to ��nd bindings for free function variable in applications, such that equations fireduce to equal terms. In general, this problem is undecida=-=ble [Gol81]. Ho-=-wever, for certain subclasses of generated terms and equations, this problem becomes decidable [Pre94]. Especially in our case, where only the pattern can contain unbound variables, i.e. uni��cati... |

2 | A Functional Language for the Speci��cation of Complex Tree Transformations - Heckmann - 1988 |

2 |
A Novel Representation of Lists and Its Apllication to the Function ireversej
- Huges
- 1986
(Show Context)
Citation Context ...ially in our case, where only the pattern can contain unbound variables, i.e. uni��cation becomes matching, the problem is decidable [Hue75]. The representation of context by functions are related=-= to [Hug86]-=-, where lists of type [a] are represented by a function of type [a]-?[a]. Given a list l, the representation is obtained by append l. In our setting such functions can occur as a special case, where t... |

1 |
Active Patterms
- Erwig
(Show Context)
Citation Context ...types, where the matching or a pattern is done by evaluation of a usedde��ned function. Dioeerent approaches based on this idea are Miranda's laws, Wadler's views [Wad87], and Erwig's active patte=-=rns [Erw97]. Anothe-=-r root of our work can be seen in higherorder uni��cation [Hue75, SG89, DJ95]. The general approach is to synthesise terms in order to ��nd bindings for free function variable in applications,... |