我一直认为无点函数的先决条件是将函数参数放到定义的末尾.例如
-- This can be made pointfree quite easily:
let lengths x = map length x
let lengths' = map length
-- However this cannot:
let lengthz x = length `map` x
-- let lengthz' = length `map` (parse error)
Run Code Online (Sandbox Code Playgroud)
我最初看到这个问题.我们有这个例子:
agreeLen :: (Eq a) => [a] -> [a] -> Int
agreeLen x y = length $ takeWhile id $ zipWith (==) x y
-- This may look like it can easily be made pointfree, however it cannot …Run Code Online (Sandbox Code Playgroud)