Documentation ¶
Index ¶
- func All[T any](slice []T, f func(T) bool) bool
- func Any[T any](slice []T, f func(T) bool) bool
- func Clip[S ~[]T, T any](slice S) S
- func Clone[S ~[]T, T any](slice S) S
- func Compact[S ~[]T, T comparable](slice S, capArg ...int) S
- func CompactSelf[S ~[]T, T comparable](slice S) S
- func CompactSelfWith[S ~[]T, T any](slice S, equaller Equaller[T]) S
- func CompactWith[S ~[]T, T any](slice S, equaller Equaller[T], capArg ...int) S
- func Contains[T comparable](slice []T, value T) bool
- func ContainsAll[T comparable](list, subset []T) bool
- func ContainsAllWith[T any](list, subset []T, equaller Equaller[T]) bool
- func ContainsWith[T any](slice []T, value T, equaller Equaller[T]) bool
- func Count[T comparable](slice []T, value T) int
- func CountWith[T any](slice []T, value T, equaller Equaller[T]) int
- func Deduplicate[T comparable, S ~[]T](slice S, capArg ...int) S
- func DeduplicateSelf[S ~[]T, T comparable](slice S) S
- func DeduplicateSelfWith[S ~[]T, T any](slice S, equaller Equaller[T]) S
- func DeduplicateWith[S ~[]T, T any](slice S, equaller Equaller[T], capArg ...int) S
- func Delete[S ~[]T, T comparable](slice S, value T, n int, capArg ...int) S
- func DeleteAll[S ~[]T, T comparable](slice S, value T, capArg ...int) S
- func DeleteAllSelf[S ~[]T, T comparable](slice S, value T) S
- func DeleteAllSelfWith[S ~[]T, T any](slice S, value T, equaller Equaller[T]) S
- func DeleteAllWith[S ~[]T, T any](slice S, value T, equaller Equaller[T], capArg ...int) S
- func DeleteSelf[S ~[]T, T comparable](slice S, value T, n int) S
- func DeleteSelfWith[S ~[]T, T any](slice S, value T, n int, equaller Equaller[T]) S
- func DeleteWith[S ~[]T, T any](slice S, value T, n int, equaller Equaller[T], capArg ...int) S
- func Diff[S ~[]T, T comparable](slice1, slice2 S, capArg ...int) S
- func DiffWith[S ~[]T, T any](slice1, slice2 S, equaller Equaller[T], capArg ...int) S
- func ElementMatch[T comparable](slice1, slice2 []T) bool
- func ElementMatchWith[T1, T2 any](slice1 []T1, slice2 []T2, equaller Equaller2[T1, T2]) bool
- func Equal[T comparable](slice1, slice2 []T) bool
- func EqualWith[T1, T2 any](slice1 []T1, slice2 []T2, equaller Equaller2[T1, T2]) bool
- func Expand[T1, T2 any](slice []T1, f func(T1) []T2, capArg ...int) []T2
- func Filter[S ~[]T, T any](slice S, f func(T) bool, capArg ...int) S
- func Foreach[T any](slice []T, f func(T))
- func Grow[S ~[]T, T any](slice S, n int) S
- func IndexOf[T comparable](slice []T, value T) int
- func IndexOfWith[T any](slice []T, value T, equaller Equaller[T]) int
- func Insert[S ~[]T, T any](slice S, index int, values ...T) S
- func InsertSelf[S ~[]T, T any](slice S, index int, values ...T) S
- func Intersect[S ~[]T, T comparable](slice1, slice2 S, capArg ...int) S
- func IntersectWith[S ~[]T, T any](slice1, slice2 S, equaller Equaller[T], capArg ...int) S
- func LastIndexOf[T comparable](slice []T, value T) int
- func LastIndexOfWith[T any](slice []T, value T, equaller Equaller[T]) int
- func Map[T1, T2 any](slice []T1, f func(T1) T2) []T2
- func Reduce[T, U any](slice []T, initial U, f func(U, T) U) U
- func Repeat[T any](value T, count uint) []T
- func Reverse[S ~[]T, T any](slice S) S
- func ReverseSelf[T any](slice []T)
- func Shuffle[S ~[]T, T any](slice S) S
- func ShuffleSelf[T any](slice []T)
- func Sort[S ~[]T, T xsugar.Ordered](slice S) S
- func SortSelf[T xsugar.Ordered](slice []T)
- func SortSelfWith[T any](slice []T, less Lesser[T])
- func SortWith[S ~[]T, T any](slice S, less Lesser[T]) S
- func StableSort[S ~[]T, T xsugar.Ordered](slice S) S
- func StableSortSelf[T xsugar.Ordered](slice []T)
- func StableSortSelfWith[T any](slice []T, less Lesser[T])
- func StableSortWith[S ~[]T, T any](slice S, less Lesser[T]) S
- func Union[S ~[]T, T comparable](slice1, slice2 S, capArg ...int) S
- func UnionWith[S ~[]T, T any](slice1, slice2 S, equaller Equaller[T], capArg ...int) S
- func Unzip[T1, T2 any](slice []xtuple.Tuple[T1, T2]) ([]T1, []T2)
- func Unzip3[T1, T2, T3 any](slice []xtuple.Triple[T1, T2, T3]) ([]T1, []T2, []T3)
- func Zip[T1, T2 any](slice1 []T1, slice2 []T2) []xtuple.Tuple[T1, T2]
- func Zip3[T1, T2, T3 any](slice1 []T1, slice2 []T2, slice3 []T3) []xtuple.Triple[T1, T2, T3]
- type Equaller
- type Equaller2
- type Lesser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clip ¶
func Clip[S ~[]T, T any](slice S) S
Clip removes unused capacity from given slice, returning slice[:len(s):len(s)].
func Clone ¶
func Clone[S ~[]T, T any](slice S) S
Clone returns a copy of given slice, and the elements are copied using assignment.
func Compact ¶
func Compact[S ~[]T, T comparable](slice S, capArg ...int) S
Compact removes the duplicate items in neighbor from []T slice.
func CompactSelf ¶
func CompactSelf[S ~[]T, T comparable](slice S) S
CompactSelf removes the duplicate items in neighbor from []T slice, by modifying given slice directly.
func CompactSelfWith ¶
CompactSelfWith removes the duplicate items in neighbor from []T slice with Equaller, by modifying given slice directly.
func CompactWith ¶
CompactWith removes the duplicate items in neighbor from []T slice with Equaller.
func Contains ¶
func Contains[T comparable](slice []T, value T) bool
Contains returns true if value is in the []T slice.
func ContainsAll ¶
func ContainsAll[T comparable](list, subset []T) bool
ContainsAll returns true if values in []T subset are all in the []T list.
func ContainsAllWith ¶
ContainsAllWith returns true if values in []T subset are all in the []T list with Equaller.
func ContainsWith ¶
ContainsWith returns true if value is in the []T slice with Equaller.
func Count ¶
func Count[T comparable](slice []T, value T) int
Count returns the count of value in the []T slice.
func Deduplicate ¶
func Deduplicate[T comparable, S ~[]T](slice S, capArg ...int) S
Deduplicate removes the duplicate items from []T slice as a set.
func DeduplicateSelf ¶
func DeduplicateSelf[S ~[]T, T comparable](slice S) S
DeduplicateSelf removes the duplicate items from []T slice as a set, by modifying given slice directly.
func DeduplicateSelfWith ¶
DeduplicateSelfWith removes the duplicate items from []T slice as a set with Equaller, by modifying given slice directly.
func DeduplicateWith ¶
DeduplicateWith removes the duplicate items from []T slice as a set with Equaller.
func Delete ¶
func Delete[S ~[]T, T comparable](slice S, value T, n int, capArg ...int) S
Delete deletes value from []T slice in n times.
func DeleteAll ¶
func DeleteAll[S ~[]T, T comparable](slice S, value T, capArg ...int) S
DeleteAll deletes value from []T slice in all.
func DeleteAllSelf ¶
func DeleteAllSelf[S ~[]T, T comparable](slice S, value T) S
DeleteAllSelf deletes value from []T slice in all, by modifying given slice directly.
func DeleteAllSelfWith ¶
DeleteAllSelfWith deletes value from []T slice in all with Equaller, by modifying given slice directly.
func DeleteAllWith ¶
DeleteAllWith deletes value from []T slice in all with Equaller.
func DeleteSelf ¶
func DeleteSelf[S ~[]T, T comparable](slice S, value T, n int) S
DeleteSelf deletes value from []T slice in n times, by modifying given slice directly.
func DeleteSelfWith ¶
DeleteSelfWith deletes value from []T slice in n times with Equaller, by modifying given slice directly.
func DeleteWith ¶
DeleteWith deletes value from []T slice in n times with Equaller.
func Diff ¶
func Diff[S ~[]T, T comparable](slice1, slice2 S, capArg ...int) S
Diff returns the difference of two []T slices.
func ElementMatch ¶
func ElementMatch[T comparable](slice1, slice2 []T) bool
ElementMatch checks whether two []T slices equal (ignore the order of the elements, but the number of duplicate elements should match).
func ElementMatchWith ¶
ElementMatchWith checks whether two slices equal (ignore the order of the elements, but the number of duplicate elements should match) with Equaller.
func Equal ¶
func Equal[T comparable](slice1, slice2 []T) bool
Equal checks whether two []T slices equal (the same length and all elements equal).
func EqualWith ¶
EqualWith checks whether two slices equal (the same length and all elements equal) with Equaller.
func Foreach ¶
func Foreach[T any](slice []T, f func(T))
Foreach invokes given function for each item of given slice.
func Grow ¶
Grow increases given slice's capacity, if necessary, to guarantee space for another n elements.
func IndexOf ¶
func IndexOf[T comparable](slice []T, value T) int
IndexOf returns the first index of value in the []T slice.
func IndexOfWith ¶
IndexOfWith returns the first index of value in the []T slice with Equaller.
func Insert ¶
Insert inserts values into []T slice at index position using a new slice space to store.
func InsertSelf ¶
InsertSelf inserts values into []T slice at index position using the space of given slice.
func Intersect ¶
func Intersect[S ~[]T, T comparable](slice1, slice2 S, capArg ...int) S
Intersect returns the intersection of two []T slices.
func IntersectWith ¶
IntersectWith returns the intersection of two []T slices with Equaller.
func LastIndexOf ¶
func LastIndexOf[T comparable](slice []T, value T) int
LastIndexOf returns the last index of value in the []T slice.
func LastIndexOfWith ¶
LastIndexOfWith returns the last index of value in the []T slice with Equaller.
func Map ¶
func Map[T1, T2 any](slice []T1, f func(T1) T2) []T2
Map maps given slice to another slice using mapper function.
func Reduce ¶
func Reduce[T, U any](slice []T, initial U, f func(U, T) U) U
Reduce reduces given slice to a single value using initial value and left reducer function.
func Reverse ¶
func Reverse[S ~[]T, T any](slice S) S
Reverse reverses the []T slice and returns the result.
func ReverseSelf ¶
func ReverseSelf[T any](slice []T)
ReverseSelf reverses the []T slice, by modifying given slice directly.
func Shuffle ¶
func Shuffle[S ~[]T, T any](slice S) S
Shuffle shuffles the []T slice and returns the result.
func ShuffleSelf ¶
func ShuffleSelf[T any](slice []T)
ShuffleSelf shuffles the []T slice, by modifying given slice directly.
func SortSelfWith ¶
SortSelfWith sorts the []T slice with less function, by modifying given slice directly.
func StableSort ¶
StableSort sorts the []T slice in stable and returns the result.
func StableSortSelf ¶
StableSortSelf sorts the []T slice in stable, by modifying given slice directly.
func StableSortSelfWith ¶
StableSortSelfWith sorts the []T slice in stable with less function, by modifying given slice directly.
func StableSortWith ¶
StableSortWith sorts the []T slice in stable with less function and returns the result.
func Union ¶
func Union[S ~[]T, T comparable](slice1, slice2 S, capArg ...int) S
Union returns the union of two []T slices.
Types ¶
type Equaller ¶
Equaller represents an equality function for two values, is used in XXXWith methods.