私は与えられたリストから、すべての数字を加算してから6整数リストの平均を計算するのがなぜ機能しないのですか?
average :: [Integer] -> Integer
average m = (sum m) quot 6
で除算しかし、これは私が受けてるのエラーメッセージで機能させるためにしようとしている:
Couldn't match type `Integer'
with `(a0 -> a0 -> a0) -> a1 -> Integer'
Expected type: [(a0 -> a0 -> a0) -> a1 -> Integer]
Actual type: [Integer]
In the first argument of `sum', namely `m'
In the expression: (sum m) quot 6
を
'(sum m)quot 6 'は' 'sum'を取って' m'に適用し、得られた関数を取り出して 'quot'に適用し、結果の関数をとり、' 6 ''これは 'sum m quot 6 'と同じです。しかし、 'sum m'は関数を返さないので、型エラーが発生します。 – chi