internal/dis: Rework initialization
This commit is contained in:
parent
4358320433
commit
abc985892a
4 changed files with 173 additions and 156 deletions
|
|
@ -16,6 +16,18 @@ func ForSorted[K constraints.Ordered, V any](mp map[K]V, callback func(k K, v V)
|
|||
}
|
||||
}
|
||||
|
||||
// First returns the first value of type V
|
||||
// When no such value exists, returns the zero value
|
||||
func First[V any](values []V, test func(v V) bool) V {
|
||||
for _, v := range values {
|
||||
if test(v) {
|
||||
return v
|
||||
}
|
||||
}
|
||||
var v V
|
||||
return v
|
||||
}
|
||||
|
||||
// Any returns true if test returns true for any of values.
|
||||
func Any[T any](values []T, test func(T) bool) bool {
|
||||
for _, v := range values {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue