Error: This expression was expected to have type byte [] but here has type 'a * 'b * 'c" in F#
Error: This expression was expected to have type byte [] but here has type 'a * 'b * 'c" in F#
let IndexOf (searchWithin:byte[])(searchFor:byte[])(startIndex:int):(int) =
//Function defination
0
//calling thisfunction using below
let endIndex = IndexOf(data, delimiterBytes, startIndex)
//data is type of byte[], delimiterBytes is also type of byte[] and
//startIndex is type of interger.
我收到类似 "This expression was expected to have type byte [] but here has type 'a * 'b * 'c" 的错误。我不明白 'a * 'b * 'c 是什么意思以及为什么它显示错误。谢谢
问题是您的函数定义采用所谓的柯里化形式,例如
let t a b c = ...
需要这样使用:
t 1 2 3
您可以将声明更改为元组形式
let t (a,b,c) = ...
或将用法更改为
t 1 2 3
这是咖喱形式。
有关差异的更多信息,请参见此处的示例:F# parameter passing
let IndexOf (searchWithin:byte[])(searchFor:byte[])(startIndex:int):(int) =
//Function defination
0
//calling thisfunction using below
let endIndex = IndexOf(data, delimiterBytes, startIndex)
//data is type of byte[], delimiterBytes is also type of byte[] and
//startIndex is type of interger.
我收到类似 "This expression was expected to have type byte [] but here has type 'a * 'b * 'c" 的错误。我不明白 'a * 'b * 'c 是什么意思以及为什么它显示错误。谢谢
问题是您的函数定义采用所谓的柯里化形式,例如
let t a b c = ...
需要这样使用:
t 1 2 3
您可以将声明更改为元组形式
let t (a,b,c) = ...
或将用法更改为
t 1 2 3
这是咖喱形式。
有关差异的更多信息,请参见此处的示例:F# parameter passing