fn: add curried (in)equality functions

This commit is contained in:
Keagan McClelland 2024-04-26 18:52:22 -07:00
parent c4df2f1dce
commit 9c30bce10c
No known key found for this signature in database
GPG Key ID: FA7E65C951F12439

View File

@ -28,3 +28,19 @@ func Const[A, B any](a A) func(B) A {
return a
}
}
// Eq is a curried function that returns true if its eventual two arguments are
// equal.
func Eq[A comparable](x A) func(A) bool {
return func(y A) bool {
return x == y
}
}
// Neq is a curried function that returns true if its eventual two arguments are
// not equal.
func Neq[A comparable](x A) func(A) bool {
return func(y A) bool {
return x != y
}
}