The trie data structure is a good choice for finite maps whose keys are data structures (trees) rather than atomic values. But what if we want the keys to be patterns, each of which matches many lookup keys? Efficient matching of this kind is well studied in the theorem prover community, but much less so in the context of statically typed functional programming. Doing so yields an interesting new viewpoint -- and a practically useful design pattern, with good runtime performance.
翻译:Trie数据结构是一种适用于键为数据结构(树)而非原子值的有限映射的良好选择。但如果希望键是模式,且每个模式匹配多个查找键,该如何处理?这类高效匹配在定理证明社区中已被充分研究,但在静态类型函数式编程的背景下却鲜有探讨。为此展开研究,不仅能带来有趣的新视角,还能形成一种具有良好运行时性能的实用设计模式。