想知道我是否可以在编写这个函数时得到一些帮助。我正在尝试创建一个反转列表中每个“对”的函数。
module Invert where
invert :: [(a,b)] -> [(b,a)]
invert [(a,b)] = [(b,a)]
当我进入时invert [(3,1) (4,1) (5,1)]
......它应该给我[(1,3) (1,4) (1,5)
......但它给了我......
*Invert> [(3,1) (4,1) (5,1)]
<interactive>:2:2:
The function `(3, 1)' is applied to two arguments,
but its type `(t0, t1)' has none
In the expression: (3, 1) (4, 1) (5, 1)
In the expression: [(3, 1) (4, 1) (5, 1)]
In an equation for `it': it = [(3, 1) (4, 1) (5, 1)]