(init . cuts) [1,2,3]
この 2 つの評価:とinit . cuts [1,2,3]
が異なる理由を理解しようとしています。
cuts :: [a] -> [([a],[a])]
cuts xs = zipWith splitAt [0..length xs] (repeat xs)
最初の結果は、[([],[1,2,3]),([1],[2,3]),([1,2],[3])] ですが、 2 番目は次のエラーを返します。
<interactive>:389:8:
Couldn't match expected type `a0 -> [a1]'
with actual type `[([a2], [a2])]'
In the return type of a call of `cuts'
Probable cause: `cuts' is applied to too many arguments
In the second argument of `(.)', namely `cuts [1, 2, 3]'
In the expression: init . cuts [1, 2, 3]
だと思いinit . cuts [1,2,3] = init (cuts[1,2,3])
ますが、これは正しいですか?
ありがとう、
セバスチャン。