相关疑难解决方法(0)

Haskell中无点函数的先决条件是什么?

我一直认为无点函数的先决条件是将函数参数放到定义的末尾.例如

-- 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)

haskell function pointfree

2
推荐指数
2
解决办法
576
查看次数

标签 统计

function ×1

haskell ×1

pointfree ×1