The practical expressiveness of non-linear pattern matching is insufficient with basic join patterns (`xs ++ ys`) alone; order-independent collection matching is indispensable. This paper reports on the design and implementation of multiset patterns (order-independent matching with duplicates), set patterns (order-independent matching with uniqueness constraints), nested join patterns (recursive list splitting), and logical connective patterns (And/Or/Not) in the egison-patterns library. The multiset matching employs a backtracking algorithm, and the optimized implementation adopts uint64 bitmask-based O(1) index tracking. For collections of 64 elements or fewer, the bitmask approach demonstrates significant improvements in cache efficiency compared to the HashSet approach. The integration of non-linear variables with collection patterns enables natural expression of patterns such as "detecting duplicate elements in a multiset."
Building similarity graph...
Analyzing shared references across papers
Loading...
MITSUDA et al. (Fri,) studied this question.
www.synapsesocial.com/papers/69bf899af665edcd009e9714 — DOI: https://doi.org/10.5281/zenodo.19139116
Wataru MITSUDA
Inc. Gods & Golem
Building similarity graph...
Analyzing shared references across papers
Loading...