我有一個函數的組合,其中許多是運算符,用於將恆定的常數減去列表中第i個集合的大小。這裏是我的代碼:Haskell函數鏈
(k^).(n-).size.(phi !!) i
當我試圖在一個測試用例我
<interactive>:64:16-25:
Couldn't match expected type ‘a -> Set a0’
with actual type ‘Set a1’
Relevant bindings include
it :: a -> c (bound at <interactive>:64:1)
Possible cause: ‘phi !!’ is applied to too many arguments
In the second argument of ‘(.)’, namely ‘(phi !!) 3’
In the second argument of ‘(.)’, namely ‘size . (phi !!) 3’
然而,
(k^)$(n-)$size$(phi !!)$i
作品。怎麼了?爲什麼組合不起作用,但應用程序工作?另外,是否將括號中的操作符寫成最慣用的方式呢?感覺很奇怪。
只是寫'k ^(n - size(phi !! i))'會不會好得多? –