Documentation ¶
Index ¶
- func Contains[T comparable](vs []T, needle T) bool
- func ContainsFunc[T any](vs []T, f func(v T) bool) bool
- func Equal[T comparable](vs1 []T, vs2 []T) bool
- func EqualFunc[T any](vs1 []T, vs2 []T, f func(v1 T, v2 T) bool) bool
- func Find[T any](vs []T, f func(T) bool) (T, bool)
- func Map[T any, U any](vs []T, f func(T) U) []U
- func Random[T any](vs []T) T
- func Unique[T comparable](vs []T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](vs []T, needle T) bool
Contains returns true if needle exists in vs.
func ContainsFunc ¶
ContainsFunc returns true if f returns true for any element in vs.
func Equal ¶
func Equal[T comparable](vs1 []T, vs2 []T) bool
Equal returns true if vs1 and vs2 are equal (contain the same elements in the same order.)
func EqualFunc ¶
EqualFunc returns true if vs1 and vs2 are of the same length and f returns true for all pairs from vs1 and vs2 to be compared.
func Random ¶
func Random[T any](vs []T) T
Random returns a random element from vs. If vs is empty or nil, the default value of T is returned.
func Unique ¶
func Unique[T comparable](vs []T) []T
Unique returns a new list containing unique values from v.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.