在 ocaml 中对负浮点数使用 atan2 时出现解析错误
# atan2 -2. 3. ;;
Line 1, characters 0-5:
Error: This expression has type float -> float -> float
but an expression was expected of type int
我必须使用
atan2 (-2.) 3.
为什么ocaml不能正确解析-2.
在 OCaml 中,空格在标记化之外并不重要。此外,
-
始终被视为单独的标记。换句话说,
atan2 -2.
被解析为
atan2 - 2.
确实是类型错误。