mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 14:22:37 +01:00
fn: add Elem function for set membership
This commit is contained in:
parent
9c30bce10c
commit
fb1437cb6d
1 changed files with 5 additions and 0 deletions
|
@ -114,6 +114,11 @@ func FindIdx[A any](pred Pred[A], s []A) Option[T2[int, A]] {
|
|||
return None[T2[int, A]]()
|
||||
}
|
||||
|
||||
// Elem returns true if the element in the argument is found in the slice
|
||||
func Elem[A comparable](a A, s []A) bool {
|
||||
return Any(Eq(a), s)
|
||||
}
|
||||
|
||||
// Flatten takes a slice of slices and returns a concatenation of those slices.
|
||||
func Flatten[A any](s [][]A) []A {
|
||||
sz := Foldr(
|
||||
|
|
Loading…
Add table
Reference in a new issue