我试图了解 Haskell 是如何评估pp1 [1,2,3,4]
到[(1,2),(2,3),(3,4)]
这里的:
1. xnull f [] = []
2. xnull f xs = f xs
3. (/:/) f g x = (f x) (g x)
4. pp1 = zip /:/ xnull tail
我是这样开始的:
a) pp1 [1,2,3,4] = (zip /:/ xnull tail) [1,2,3,4] -- (rule 4).
b) (zip /:/ xnull tail) [1,2,3,4]
= (zip (xnull [1,2,3,4]) (tail) [1,2,3,4]) -- (rule 3)
c) -- I'm not sure how to continue because xnull receives a function
-- and a param, and in this case it only receives a param.
有什么帮助吗?