Practical use of curried functions?

后端 未结 10 864
粉色の甜心
粉色の甜心 2020-12-14 07:01

There are tons of tutorials on how to curry functions, and as many questions here at stackoverflow. However, after reading The Little Schemer, several books, tutorials, blog

10条回答
  •  粉色の甜心
    2020-12-14 07:21

    Using all :: (a -> Bool) -> [a] -> Bool with a curried predicate.

    all (`elem` [1,2,3]) [0,3,4,5]
    

    Haskell infix operators can be curried on either side, so you can easily curry the needle or the container side of the elem function (is-element-of).

提交回复
热议问题