Last active
September 2, 2020 00:20
-
-
Save evanricard/2b06cd21fcd7476406934c637e183da7 to your computer and use it in GitHub Desktop.
Gulag-derived predicate syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Func<T, bool> Not<T>(this Func<T, bool> predicate) | |
{ | |
return a => !predicate(a); | |
} | |
public static Func<T, bool> And<T>(this Func<T, bool> left, Func<T, bool> right) | |
{ | |
return a => left(a) && right(a); | |
} | |
public static Func<T, bool> Or<T>(this Func<T, bool> left, Func<T, bool> right) | |
{ | |
return a => left(a) || right(a); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment