What are some interesting uses of higher-order functions?

后端 未结 14 711
走了就别回头了
走了就别回头了 2021-01-30 00:55

I\'m currently doing a Functional Programming course and I\'m quite amused by the concept of higher-order functions and functions as first class citizens. However, I can\'t yet

14条回答
  •  误落风尘
    2021-01-30 01:44

    I'm a particular fan of higher-order memoization:

    memo :: HasTrie t => (t -> a) -> (t -> a)
    

    (Given any function, return a memoized version of that function. Limited by the fact that the arguments of the function must be able to be encoded into a trie.)

    This is from http://hackage.haskell.org/package/MemoTrie

提交回复
热议问题