package slices // Contains is a generic function that returns true if the element is contained within the slice func Contains[T comparable](elems []T, v T) bool { for _, s := range elems { if v == s { return true } } return false } // IndexFunc returns the first index i satisfying f(s[i]), // or -1 if none do. func IndexFunc[E any](s []E, f func(E) bool) int { for i, v := range s { if f(v) { return i } } return -1 }