Documentation ¶
Index ¶
- func Chunk[T any](s []T, chunkSize int) [][]T
- func ChunkProcess[T any](s []T, chunkSize int, process func([]T) error) error
- func Contains[T comparable](s []T, v T) bool
- func Copy[T any](s []T, start, length int) []T
- func Diff[T comparable](dst, s1, s2 []T) []T
- func DiffInPlaceFirst[T comparable](s1, s2 []T) []T
- func Equal[T comparable](s1, s2 []T) bool
- func Filter[T any](dst, s []T, predicate func(T) bool) []T
- func FilterInPlace[T any](s []T, predicate func(T) bool) []T
- func Index[T comparable](s []T, v T) int
- func Intersect[T comparable](dst, s1, s2 []T) []T
- func IntersectInPlaceFirst[T comparable](s1, s2 []T) []T
- func Unique[T comparable](dst, s []T) []T
- func UniqueInPlace[T comparable](s []T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChunkProcess ¶
ChunkProcess splits slice s into chunks of size chunkSize, and calls process on each chunk.
func Contains ¶
func Contains[T comparable](s []T, v T) bool
Contains returns true if v is present in s.
func Copy ¶
Copy copies length elements from s starting at position start. If length is negative, it will copy all elements from start to the end of s.
func Diff ¶
func Diff[T comparable](dst, s1, s2 []T) []T
Diff compares slices s1 and s2, puts elements from s1 that do not exist in s2 into dst, and returns it.
func DiffInPlaceFirst ¶
func DiffInPlaceFirst[T comparable](s1, s2 []T) []T
DiffInPlaceFirst compares s1 and s2, moves elements from s1 that not in s2 to the front of s1, and returns this portion of s1. Please note that the order of elements in s1 will be altered.
func Equal ¶
func Equal[T comparable](s1, s2 []T) bool
Equal compares slices s1 and s2, and returns true if they are equal. If s1 or s2 is nil, it returns true.
func FilterInPlace ¶
FilterInPlace moves elements that satisfy predicate to the front of s, and returns this portion of s. Please note that the order of elements in s will be altered.
func Index ¶
func Index[T comparable](s []T, v T) int
Index returns the index of the first instance of v in s, or -1 if v is not present in s.
func Intersect ¶
func Intersect[T comparable](dst, s1, s2 []T) []T
Intersect compares slices s1 and s2, puts elements from s1 that are also present in s2 into dst, and returns it.
func IntersectInPlaceFirst ¶
func IntersectInPlaceFirst[T comparable](s1, s2 []T) []T
IntersectInPlaceFirst compares s1 and s2, moves elements from s1 that are also present in s2 to the front of s1, and returns this portion of s1. Please note that the order of elements in s1 will be altered.
func Unique ¶
func Unique[T comparable](dst, s []T) []T
Unique compares slice s, puts unique elements into dst, and returns it.
func UniqueInPlace ¶
func UniqueInPlace[T comparable](s []T) []T
UniqueInPlace compares slice s, moves unique elements to the front of s, and returns this portion of s. Please note that the order of elements in s will be altered.
Types ¶
This section is empty.