Documentation ¶
Index ¶
- func All[T any](s []T, f Predicate[T]) bool
- func Any[T any](s []T, f Predicate[T]) bool
- func AppendUnique[T comparable](s []T, vs ...T) []T
- func ApplyToAll[T, U any](s []T, f func(T) U) []U
- func Chunks[S ~[]E, E any](s S, size int) []S
- func Filter[T any](s []T, f Predicate[T]) []T
- func RemoveAll[E comparable](s []E, r E) []E
- func Reverse[S ~[]E, E any](s S) S
- type Predicate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendUnique ¶
func AppendUnique[T comparable](s []T, vs ...T) []T
AppendUnique appends unique (not already in the slice) values to a slice.
func ApplyToAll ¶
func ApplyToAll[T, U any](s []T, f func(T) U) []U
ApplyToAll returns a new slice containing the results of applying the function `f` to each element of the original slice `s`.
func Filter ¶
Filter returns a new slice containing all values that return `true` for the filter function `f`
func RemoveAll ¶
func RemoveAll[E comparable](s []E, r E) []E
RemoveAll removes all occurrences of the specified value from a slice.
Types ¶
type Predicate ¶
Predicate represents a predicate (boolean-valued function) of one argument.
func PredicateEquals ¶
func PredicateEquals[T comparable](v T) Predicate[T]
PredicateEquals returns a Predicate that evaluates to true if the predicate's argument equals `v`.
func PredicateTrue ¶
PredicateTrue returns a Predicate that always evaluates to true.
Click to show internal directories.
Click to hide internal directories.