slices

package
v0.0.0-...-f1100e8 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const NotFound = -1

NotFound is an index that is reported when no value is found.

Variables

This section is empty.

Functions

func Copy

func Copy[I any](v []I) []I

func Equal

func Equal[I comparable](a, b []I) bool

Equal tells whether a and b contain the same elements. A nil argument is equivalent to an empty slice.

Via https://yourbasic.org/golang/compare-slices/.

func Exclude

func Exclude[I comparable](slice []I, item I) ([]I, bool)

func ExcludeFrom

func ExcludeFrom[I comparable](slice *[]I, item I) bool

func Find

func Find[I any](slice []I, predicate Predicate[I]) *I

func FindIndex

func FindIndex[I any](slice []I, predicate Predicate[I]) int

func Includes

func Includes[I comparable](slice []I, item I) bool

func Push

func Push[I any](slice *[]I, values ...I)

func Some

func Some[I any](value []I, predicate Predicate[I]) bool

Types

type Predicate

type Predicate[I any] func(item *I, index int, slice []I) bool

Jump to

Keyboard shortcuts

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