Are some data structures more suitable for functional programming than others?

后端 未结 9 678
灰色年华
灰色年华 2021-01-31 19:23

In Real World Haskell, there is a section titled \"Life without arrays or hash tables\" where the authors suggest that list and trees are preferred in functional programming, w

9条回答
  •  一向
    一向 (楼主)
    2021-01-31 19:29

    Yes, the usage patterns are dramatically different, but no it's not a problem. If you want a hash table, you usually mean you want a finite map with string keys and fast access. Bentley and Sedgewick's ternary search trees are pureful functional, and at least in some cases, they outperform hash tables.

    As mentioned above, Chris Okasaki's book on purely functional data structures is very good.

提交回复
热议问题