exception div;
fun f(x,y) =
let
val before = 2.0 * x + 3.0 * y
in
(before + (1.0 / (if x > 0.0001 then x else raise div)) + 2.0 / y) handle div => before / 6.0
end
此代码产生一些编译错误。
那是
e.sml:4.8-4.14 错误:表达式或模式以中缀标识符“before”
开头 e.sml:6.8-6.14 错误:表达式或模式以中缀标识符“before”
开头 e.sml:6.57-6.60 错误:表达式或模式以中缀标识符“div”
开头 e.sml:6.81-6.84 错误:表达式或模式以中缀标识符“div”
开头 e.sml:6.88-6.94 错误:表达式或模式以中缀标识符“before”开头
为什么会出现这个错误?我没有使用中缀代码,而只是使用变量和异常。