Documentation ¶
Index ¶
- func Accumulate[S ~[]T, F ~func(U, T) U, T constraints.Number | ~string, ...](s S, f F, begin U) U
- func Clone[S ~[]T, T any](s S) S
- func Contains[S ~[]T, T comparable](s S, v T) bool
- func CopyFunc[D ~[]U, S ~[]T, F ~func(T) U, T any, U any](d D, s S, f F)
- func Equal[X ~[]T, Y ~[]T, T comparable](x X, y Y) bool
- func EqualFunc[X ~[]U, Y ~[]V, F ~func(U, V) bool, U any, V any](x X, y Y, f F) bool
- func Index[S ~[]T, T comparable](s S, v T) int
- func IndexFunc[S ~[]T, F ~func(T) bool, T any](s S, f F) int
- func LastIndex[S ~[]T, T comparable](s S, v T) int
- func LastIndexFunc[S ~[]T, F ~func(T) bool, T any](s S, f F) int
- func Map[S ~[]T, F ~func(T) U, T any, U any](s S, f F) []U
- func Max[S ~[]T, T constraints.Ordered](s S) T
- func MaxFunc[S ~[]T, F ~func(T) U, T any, U constraints.Ordered](s S, f F) U
- func Mean[S ~[]T, T constraints.Real](s S) T
- func MeanFunc[S ~[]T, F ~func(T) U, T constraints.Number, U constraints.Real](s S, f F) U
- func Min[S ~[]T, T constraints.Ordered](s S) T
- func MinFunc[S ~[]T, F ~func(T) U, T any, U constraints.Ordered](s S, f F) U
- func Minmax[S ~[]T, T constraints.Ordered](s S) T
- func MinmaxFunc[S ~[]T, F ~func(T) U, T any, U constraints.Ordered](s S, f F) U
- func Shrink[S ~[]T, T any](s S) S
- func Shuffle[S ~[]T, T any](s S) S
- func ShuffleN[S ~[]T, T any](s S, n int) S
- func Splice[S ~[]T, T any](s S, i, n int, inserted ...T) S
- func Sum[S ~[]T, T constraints.Number | ~string](s S) T
- func SumFunc[S ~[]T, F ~func(T) U, T constraints.Number | ~string, ...](s S, f F) U
- func Unique[S ~[]T, T comparable](s S) S
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Accumulate ¶ added in v0.2.19
func Accumulate[ S ~[]T, F ~func(U, T) U, T constraints.Number | ~string, U constraints.Number | ~string, ](s S, f F, begin U) U
Accumulate accumulates slice from begin by function f
func Contains ¶
func Contains[S ~[]T, T comparable](s S, v T) bool
Contains reports whether v is present in s.
func Equal ¶
func Equal[X ~[]T, Y ~[]T, T comparable](x X, y Y) bool
Equal reports whether two slices are equal: the same length and all elements equal.
func EqualFunc ¶
EqualFunc reports whether two slices are equal using a comparison function on each pair of elements.
func Index ¶
func Index[S ~[]T, T comparable](s S, v T) int
Index returns the index of the first occurrence of v in s, or -1 if not present.
func LastIndex ¶
func LastIndex[S ~[]T, T comparable](s S, v T) int
LastIndex returns the index of the last occurrence of v in s, or -1 if not present.
func LastIndexFunc ¶
LastIndexFunc returns the first index i satisfying f(s[i]), or -1 if none do.
func MaxFunc ¶ added in v0.2.19
func MaxFunc[ S ~[]T, F ~func(T) U, T any, U constraints.Ordered, ](s S, f F) U
MaxFunc retrieves maxinum value of slice
func MeanFunc ¶
func MeanFunc[ S ~[]T, F ~func(T) U, T constraints.Number, U constraints.Real, ](s S, f F) U
MeanFunc computes mean value mapped by function f of slice
func MinFunc ¶ added in v0.2.19
func MinFunc[ S ~[]T, F ~func(T) U, T any, U constraints.Ordered, ](s S, f F) U
MinFunc retrieves mininum value of slice
func Minmax ¶
func Minmax[S ~[]T, T constraints.Ordered](s S) T
Minmax retrieves mininum and maxinum value of slice
func MinmaxFunc ¶ added in v0.2.19
func MinmaxFunc[ S ~[]T, F ~func(T) U, T any, U constraints.Ordered, ](s S, f F) U
MinmaxFunc retrieves mininum and maxinum value of slice
func Shrink ¶
func Shrink[S ~[]T, T any](s S) S
Shrink removes unused capacity from the slice, returning s[:len(s):len(s)].
func SumFunc ¶
func SumFunc[ S ~[]T, F ~func(T) U, T constraints.Number | ~string, U constraints.Number | ~string, ](s S, f F) U
Sum sums slice mapped values by function f
func Unique ¶
func Unique[S ~[]T, T comparable](s S) S
Unique retrieves unique set from sorted slice
Types ¶
This section is empty.