Documentation ¶
Index ¶
- func Clean[T comparable](slice []T) []T
- func Difference[T comparable](a, b []T) []T
- func Disjoint[T comparable](a, b []T) bool
- func DisjointTransform[T comparable](a, b []T, transformA, transformB TransformFunc[T]) bool
- func Intersection[T comparable](a, b []T) []T
- func Map[T, U any](s []T, f func(T) U) []U
- func Uniq[T comparable](s []T) []T
- type TransformFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Difference ¶ added in v0.28.0
func Difference[T comparable](a, b []T) []T
Difference returns the difference between two slices a and b, it should contain all the elements that are in a but not in b.
func Disjoint ¶
func Disjoint[T comparable](a, b []T) bool
Disjoint returns true if the two slices have no elements in common.
func DisjointTransform ¶
func DisjointTransform[T comparable](a, b []T, transformA, transformB TransformFunc[T]) bool
DisjointTransform returns true if the two slices have no elements in common, it takes two transform functions that are applied to the elements of each slice before comparing them.
func Intersection ¶
func Intersection[T comparable](a, b []T) []T
func Map ¶ added in v0.28.0
func Map[T, U any](s []T, f func(T) U) []U
Map returns a new slice containing the results of applying the function f to each element of the original slice.
func Uniq ¶
func Uniq[T comparable](s []T) []T
Types ¶
type TransformFunc ¶
type TransformFunc[T comparable] func(T) T
Click to show internal directories.
Click to hide internal directories.