我有這兩個表達式:
foldr (-) 0 . map (uncurry (*)) $ coords 5 7
foldr (-) 0 . map (uncurry (*)) (coords 5 7)
的(1)作品打印出來的結果,但(2)有錯誤說:
<interactive>:50:15:
Couldn't match expected type ‘a -> t0 c’
with actual type ‘[Integer]’
Relevant bindings include
it :: a -> c (bound at <interactive>:50:1)
Possible cause: ‘map’ is applied to too many arguments
In the second argument of ‘(.)’, namely
‘map (uncurry (*)) (coords 5 7)’
In the expression: foldr (-) 0 . map (uncurry (*)) (coords 5 7)
任何人都可以告訴我這兩者有什麼區別?謝謝。
我現在看到,謝謝,我想知道爲什麼(uncurry(*)))作爲參數與()不會導致問題,但最後一個參數(座標5 7)呢?和順便說一句,如果表達式中有多個$?口譯員會如何解釋這個表達? – linjunshi