0
这里是我的代码:类型不匹配错误
open System
let rec gcd a b =
match b with
| x when x = 0 -> a
| _ -> gcd(b, a % b)
let result = gcd 15 10
[<EntryPoint>]
let main(args : string[]) =
printfn "result = %d" result
0
为什么我的错误与此代码:
D:\datahub\Dropbox\development\myprojects\project-euler\Problem_5\problem_5.fs(6,16): error FS0001: Type mismatch. Expec
ting a
'a
but given a
int -> 'a
The resulting type would be infinite when unifying ''a' and 'int -> 'a'
参见http://lorgonblog.wordpress.com/2008/04/03/f-function-types-fun-with-tuples:在F#多个参数是由他们使用空格分开供给函数 - 和 - 柯里/ – Brian