Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

F# function negation chain

Tags:

f#

I want to negate the return value of a function in a cool way.

Given this function:

let yes = fun() -> true

I want to implement no as a negation of yes

let no = not yes //doesn't work

Does any kind of syntatic sugar exist in F# to make this possible?

P.S. I am not looking for this:

let no = fun() -> not yes() // boring
like image 726
Paul Nikonowicz Avatar asked Apr 02 '12 18:04

Paul Nikonowicz


1 Answers

This will work:

let no = not << yes
like image 123
Ramon Snir Avatar answered Sep 28 '22 01:09

Ramon Snir