slices

package
v0.23.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Average

func Average[T Number](slice []T) T

func Concat

func Concat[T any](s ...[]T) []T

func Contains added in v0.22.1

func Contains[T comparable](slice []T, elem T) bool

func Filter

func Filter[T any](slice []T, filter func(T) bool) []T

func Intersection

func Intersection[T comparable](arrays ...[]T) []T

func IsSubset

func IsSubset[T comparable](subset, superset []T) bool

func Map added in v0.23.0

func Map[T, V any](slice []T, filter func(T) V) []V

func Max

func Max[T constraints.Ordered](s []T) (m T)

func Min

func Min[T constraints.Ordered](s []T) (m T)

func Remove added in v0.22.1

func Remove[T comparable](slice []T, elem T) ([]T, bool)

Remove removes the first instance (if exists) of elem from the slice, and returns the new slice and indication if removal took place.

func Slice

func Slice[T any](v ...T) []T

func Union added in v0.22.0

func Union[T comparable](arrays ...[]T) []T

func UnionByFunc added in v0.22.0

func UnionByFunc[T ComparableByFunc](arrays ...[]T) []T

func UnorderedEqual

func UnorderedEqual[T comparable](slices ...[]T) bool

Types

type ComparableByFunc added in v0.22.0

type ComparableByFunc interface {
	Differentiator() string
}

type Number

type Number interface {
	constraints.Float | constraints.Integer
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL