English

Loop Patterns: Extension of Kleene Star Operator for More Expressive Pattern Matching against Arbitrary Data Structures

Programming Languages 2018-09-11 v1 Logic in Computer Science

Abstract

The Kleene star operator is an important pattern construct for representing a pattern that repeats multiple times. Due to its simplicity and usefulness, it is imported into various pattern-matching systems other than regular expressions. For example, Mathematica has a similar pattern construct called the repeated pattern. However, they have the following limitations: (i) We cannot change the pattern repeated depending on the current repeat count, and (ii) we cannot apply them to arbitrary data structures such as trees and graphs other than lists. This paper proposes the loop patterns that overcome these limitations. This paper presents numerous working examples and formal semantics of the loop patterns. The examples in this paper are coded in the Egison programming language, which features the customizable non-linear pattern-matching facility for non-free data types.

Cite

@article{arxiv.1809.03252,
  title  = {Loop Patterns: Extension of Kleene Star Operator for More Expressive Pattern Matching against Arbitrary Data Structures},
  author = {Satoshi Egi},
  journal= {arXiv preprint arXiv:1809.03252},
  year   = {2018}
}

Comments

14 pages, Scheme and Functional Programming Workshop 2018

R2 v1 2026-06-23T04:00:25.383Z