当前代码
我有两个功能
f1::Int->Int->Int
f1 a b | a==1 && b==1 = 1
| otherwise = 0
[Int]
通过另一个函数将此函数应用于 a
f2::[Int]->[Int]->[Int]
f2 a b = map f1 a b
错误
Type error in application
*** Expression : map f1 c d
*** Term : map
*** Type : (e -> f) -> [e] -> [f]
*** Does not match : a -> b -> c -> d
结论
实际上我需要的是应用f1
which perform to a Int
to a [Int]
usingf2
这个问题可以在高阶函数中解决吗?或任何其他方法?...或者我怎样才能转换f2
为更高阶的函数f1
?
谢谢!