Documentation ¶
Overview ¶
package sliceutil covers utilities not found in https://pkg.golang.ir/golang.org/x/exp/slices
Index ¶
- func All[T any](t []T, fn func(i int) bool) bool
- func Any[T any](t []T, fn func(i int) bool) bool
- func Dedup[T comparable](t []T) []T
- func DedupFunc[T any, K comparable](t []T, fn func(i int) K) []T
- func Filter[T any](t []T, fn func(i int) bool) []T
- func Find[T any](t []T, fn func(i int) bool) (T, bool)
- func Head[T any](t []T) (v T, ok bool)
- func Map[K, V any](ks []K, fn func(i int) V) []V
- func MapError[K, V any](ks []K, fn func(i int) (V, error)) ([]V, error)
- func None[T any](t []T, fn func(i int) bool) bool
- func Some[T any](t []T, fn func(i int) bool) bool
- func Sum[T constraints.Integer](n []T) (total T)
- func Tail[T any](t []T) (v T, ok bool)
- func Take[T any](t []T, n int) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dedup ¶
func Dedup[T comparable](t []T) []T
func DedupFunc ¶
func DedupFunc[T any, K comparable](t []T, fn func(i int) K) []T
func Sum ¶
func Sum[T constraints.Integer](n []T) (total T)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.