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.
翻译:三角数据结构对于以数据结构(树)而不是原子值为关键要素的定点地图来说是一个不错的选择。 但如果我们想让键子成为模式,其中每一个都与许多查找键相匹配呢? 这种高效匹配在理论验证界得到了很好的研究,但在静态键入功能编程中则更少。这样可以产生一个有趣的新视角,并产生一个实用的设计模式,运行时性能良好。