我想以一种很酷的方式否定函数的返回值.
鉴于此功能:
let yes = fun() -> true
Run Code Online (Sandbox Code Playgroud)
我想实施no作为否定的肯定
let no = not yes //doesn't work
Run Code Online (Sandbox Code Playgroud)
F#中是否存在任何类型的合成糖以使其成为可能?
PS我不是在找这个:
let no = fun() -> not yes() // boring
Run Code Online (Sandbox Code Playgroud)
Ram*_*nir 11
这将有效:
let no = not << yes
Run Code Online (Sandbox Code Playgroud)