Pattern Matching Task

(Redirected from pattern matching)
Jump to navigation Jump to search

A Pattern Matching Task is a search task that includes a pattern (a match pattern) as input and requires all matching items to be in a match relation with this pattern.



  • (Wikipedia, 2009) ⇒
    • In computer science, pattern matching is the act of checking for the presence of the constituents of a given pattern. In contrast to pattern recognition, the pattern is rigidly specified. Such a pattern concerns conventionally either sequences or tree structures. Pattern matching is used to test whether things have a desired structure, to find relevant structure, to retrieve the aligning parts, and to substitute the matching part with something else. Sequence (or specifically text string) patterns are often described using regular expressions (i.e. backtracking) and matched using respective algorithms. Sequences can also be seen as trees branching for each element into the respective element and the rest of the sequence, or as trees that immediately branch into all elements.
    • Tree patterns can be used in programming languages as a general tool to process data based on its structure. Some functional programming languages such as Haskell, ML and the symbolic mathematics language Mathematica have a special syntax for expressing tree patterns and a language construct for conditional execution and value retrieval based on it. For simplicity and efficiency reasons, these tree patterns lack some features that are available in regular expressions. Depending on the languages, pattern matching can be used for function arguments, in case expressions, whenever new variables are bound, or in very limited situations such as only for sequences in assignment (in Python). Often it is possible to give alternative patterns that are tried one by one, which yields a powerful conditional programming construct. Pattern matching can benefit from guards.
    • Term rewriting and Graph rewriting languages rely on pattern matching for the fundamental way a program evaluates into a result. Pattern matching benefits most when the underlying datastructures are as simple and flexible as possible. This is especially the case in languages with a strong symbolic flavor. In homoiconic programming languages, patterns are the same kind of datatype as everything else, and can therefore be fed in as arguments to functions.


  • (Wiktionary, 2009) ⇒
    • Verb
      • 1. (intransitive) To agree, to be equal.
      • 2. (transitive) To make a successful match or pairing. They found out about his color-blindness when he couldn't match socks properly.
      • 3. (transitive) To equal or exceed in achievement. She matched him at every turn. Anything he could do, she could do better.
    • Derived terms
      • mismatch