F#功能否定链

时间:2012-04-02 18:43:37

标签: f#

我想以一种很酷的方式否定函数的返回值。

鉴于此功能:

let yes = fun() -> true

我想实现no作为否定的肯定

let no = not yes //doesn't work

F#中是否存在任何类型的合成糖以使其成为可能?

P.S。 我不是在寻找这个:

let no = fun() -> not yes() // boring

1 个答案:

答案 0 :(得分:11)

这将有效:

let no = not << yes