Lesson plan

Pattern calculus

Pattern calculus bases all computation on pattern matching of a very general kind. Like lambda calculus, it supports a uniform treatment of function evaluation. Also, it allows functions to be passed as arguments and returned as results. In addition, pattern calculus supports uniform access to the internal structure of arguments, be they pairs or lists or trees. Also, it allows patterns to be passed as arguments and returned as results. Uniform access is illustrated by a pattern-matching function that computes the size of an arbitrary data structure. In the notation of the programming language bondi, it is given by the recursive function let rec size = | x y -> (size x) + (size y) | x -> 1 The second, or default case matches the pattern against the argument and returns . This case is used only if the matching failed in the first case. The first, or special case matches against any compound, such as a non-empty list, or pair. Matching binds to the left component and to the right component. Then the body of the case adds the sizes of these components together. Similar techniques yield generic queries for searching and updating. Combining recursion and decomposition in this way yields path polymorphism. The ability to pass patterns as parameters (pattern polymorphism) is illustrated by defining a generic eliminator.…

Back to article

Article summary

Pattern calculus bases all computation on pattern matching of a very general kind. Like lambda calculus, it supports a uniform treatment of function evaluation. Also, it allows functions to be passed as arguments and returned as results. In addition, pattern calculus supports uniform access to the internal structure of arguments, be they pairs or lists or trees. Also, it allows patterns to be passed as arguments and returned as results. Uniform access is illustrated by a pattern-matching function that computes the size of an arbitrary data structure. In the notation of the programming language bondi, it is given by the recursive function let rec size = | x y -> (size x) + (size y) | x -> 1 The second, or default case matches the pattern against the argument and returns . This case is used only if the matching failed in the first case. The first, or special case matches against any compound, such as a non-empty list, or pair. Matching binds to the left component and to the right component. Then the body of the case adds the sizes of these components together. Similar techniques yield generic queries for searching and updating. Combining recursion and decomposition in this way yields path polymorphism. The ability to pass patterns as parameters (pattern polymorphism) is illustrated by defining a generic eliminator.…

Key claims

No claims recorded.

Discussion questions

  1. Summarise the article in your own words. Which single claim would you verify first, and why?
  2. Which claim in this article is most likely to be revised as the sources update? How would you check its current status?
  3. If two sources disagreed about one of these facts, what would you need in order to trust one over the other?

Bibliography

No sources recorded.

Key claims and bibliography are generated from the same tracked claims and sources as the article page.