在f#中我可以很容易地绑定(+)或(*)运算符.为什么我不能用(**)做同样的事情?
> let s = (+);;
val s : (int -> int -> int)
> let f = (**);;
let f = (**);;
------------^^
C:\Users\mqrx84\AppData\Local\Temp\stdin(4,13): error FS0010: Incomplete structured construct at or before this point in binding
Run Code Online (Sandbox Code Playgroud)
Mat*_*igh 15
因为(* *)用于多行注释.你需要用空格分隔括号和运算符,例如let f = ( ** );;
要定义以*开头的其他运算符,空格必须遵循左括号; 否则(*被解释为评论的开头:let(*+*)xy =(x + y)
来自规范 - http://fsharp.org/specs/language-spec/