有没有人拥有或知道F#中可用的持久前缀trie?(Does anyone have or know of a persistent prefix trie available in F#?)

F#的Map和Set的性能非常缺乏我的特定应用程序。 看起来好的前缀trie会在我的解释器中提升性能,特别是在名称符号查找方面。 唯一需要注意的是,它必须对添加和查找操作非常有效(特别是当键是字符串时),并且对于持久性是不可变的(意味着非破坏性更新)。

如果没有这样的野兽,OCaml或Haskell的参考实现将帮助我开始使用它。

非常感谢你!

The performance of F#'s Map and Set are pretty lacking for my particular application. It seems a nice prefix trie would step up performance in my interpreter a good bit, especially in terms of symbol lookups by name. The only caveats are that it must be highly efficient for add and lookup operations (especially when the keys are strings), and immutable for persistence (meaning non-destructive updates).

If no such beast is available, a reference implementation from OCaml or Haskell would help me get started on one.

Thank you very kindly!

最满意答案

要关闭此主题(请参阅问题评论):

Haskell实现

OCaml实现

To close this thread (see comments on question):

Haskell implementation

OCaml implementation

更多推荐