Documentation ¶
Index ¶
- func Intersection[T constraints.Ordered | constraints.Complex](slice1, slice2 []T) []T
- func IsPrime(num int) bool
- func IsSubset[T comparable](s, subset []T) bool
- func Max[T constraints.Integer | constraints.Float](s []T) T
- func Mean(s []float64) float64
- func Min[T constraints.Integer | constraints.Float](s []T) T
- func Sum[T constraints.Integer | constraints.Float | constraints.Complex](s []T) T
- func SumBy[T any, V constraints.Integer | constraints.Float](s []T, fn func(el T, index int) V) V
- func Union[T constraints.Ordered | constraints.Complex](args ...[]T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Intersection ¶ added in v1.0.3
func Intersection[T constraints.Ordered | constraints.Complex](slice1, slice2 []T) []T
Intersection return the same elements of two slices
func IsSubset ¶
func IsSubset[T comparable](s, subset []T) bool
IsSubset return true if the slice contains all the elements in the subset
func Max ¶
func Max[T constraints.Integer | constraints.Float](s []T) T
Max return the minimum value of the slice return zero value if the slice is empty
func Min ¶
func Min[T constraints.Integer | constraints.Float](s []T) T
Min return the minimum value of the slice return zero value if the slice is empty
func Sum ¶
func Sum[T constraints.Integer | constraints.Float | constraints.Complex](s []T) T
Sum return a sum of the slice
func SumBy ¶
func SumBy[T any, V constraints.Integer | constraints.Float](s []T, fn func(el T, index int) V) V
SumBy summarize the values in the slice using the given return value from the function
func Union ¶
func Union[T constraints.Ordered | constraints.Complex](args ...[]T) []T
Union return the union values of slices
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.