Documentation ¶
Overview ¶
A package to operate on slices.
Index ¶
- func Any[T any](fn func(v T) bool, slice ...T) bool
- func Append[T any](slice []T, elements ...T) []T
- func Cut[T comparable](i, j int, a ...T) []T
- func Delete[T comparable](i int, a ...T) []T
- func Filter[T any](fn func(v T) bool, slice ...T) []T
- func First[T any](slice ...T) T
- func In[T comparable](val T, slice ...T) bool
- func Index[T any](fn func(v T) bool, slice ...T) int
- func Insert[T comparable](x T, idx int, a ...T) []T
- func Last[T any](slice ...T) T
- func Limit[T any](limit int, slice ...T) []T
- func Map[T1 any, T2 any](fn func(v T1) T2, slice ...T1) []T2
- func Pop[T comparable](a ...T) (T, []T)
- func Push[T comparable](x T, a ...T) []T
- func Range(from, to int) []int
- func Size[T any](size int, slice ...T) bool
- func Slice[T any](slice []any) []T
- func Unique[T1 any, T2 comparable](fn func(v T1) T2, slice ...T1) []T1
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶ added in v0.1.19
func Append[T any](slice []T, elements ...T) []T
Append adds elements to a slice.
func Cut ¶
func Cut[T comparable](i, j int, a ...T) []T
Cut removes an element from a slice at a given position.
func Delete ¶
func Delete[T comparable](i int, a ...T) []T
Delete removes an element from a slice by value.
func First ¶ added in v0.1.18
func First[T any](slice ...T) T
First returns the first element of a slice.
func Insert ¶
func Insert[T comparable](x T, idx int, a ...T) []T
Insert adds an element at a given position in a slice.
func Unique ¶
func Unique[T1 any, T2 comparable](fn func(v T1) T2, slice ...T1) []T1
Unique returns a slice with all duplicate elements removed.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.