【发布时间】:2013-02-08 02:29:34
【问题描述】:
我有以下代码,我想返回一个布尔值或元组。 (函数isvariable 和dont_care 都返回布尔值,仅供参考)
let match_element (a, b) =
if a = b then true
else if (dont_care a) || (dont_care b) then true
else if (isvariable a) then (a, b)
else if (isvariable b) then (b, a)
else false;;
目前,它会引发以下错误:
有没有办法解决这个问题?
This expression has type 'a * 'b
but an expression was expected of type bool
(这个函数是基于Python程序的指令,我不确定在OCaml中是否可行。)
【问题讨论】:
标签: ocaml strong-typing