Documentation
¶
Overview ¶
Package slices provides generic slice utility functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
Filter removes all elements in the given slice that do not match the given predicates.
NOTE: Providing no predicates results in a no-op.
func Subset ¶
func Subset[S []E, E comparable](a, b S) bool
Subset returns a boolean indicating whether a, is a subset of b.
NOTE: Returns true if a has zero elements since an empty set is a subset of all sets.
func Sum ¶
func Sum[S []E, E constraints.Ordered](s S) E
Sum returns the summation of the elements in the provided slice.
func Union ¶
func Union[S []E, E comparable](a, b S) S
Union returns a slice of elements that are present in both input slices.
NOTE: The returned slice will not contain any duplicates.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.