我有一个函数的组合,其中许多是运算符,用于将恒定的常数减去列表中第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))'会不会好得多? –