-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from koss-null/v1.0.2
V1.0.2
- Loading branch information
Showing
6 changed files
with
95 additions
and
3 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package pipies | ||
|
||
// This madness is the only way to implement Not function for a function with arbitary amount of arguments. | ||
// The amount of t at the end of Not(t) function equals to the amount of arguments the initial function takes | ||
|
||
// Not returns a new function that negates the result of the input function. | ||
func Not[T any](fn func(x T) bool) func(T) bool { | ||
return func(x T) bool { | ||
return !fn(x) | ||
} | ||
} | ||
|
||
// Nott returns a new function that negates the result of the input function. | ||
func Nott[T1, T2 any](fn func(x T1, y T2) bool) func(T1, T2) bool { | ||
return func(x T1, y T2) bool { | ||
return !fn(x, y) | ||
} | ||
} | ||
|
||
// Nottt returns a new function that negates the result of the input function. | ||
func Nottt[T1, T2, T3 any](fn func(x T1, y T2, z T3) bool) func(T1, T2, T3) bool { | ||
return func(x T1, y T2, z T3) bool { | ||
return !fn(x, y, z) | ||
} | ||
} |
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