slices

package
v0.0.0-...-a510a1c Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package slices adds extra helpers to the standard library slices package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinarySearch

func BinarySearch[S ~[]E, E cmp.Ordered](x S, target E) (int, bool)

func BinarySearchFunc

func BinarySearchFunc[S ~[]E, E, T any](x S, target T, cmp func(E, T) int) (int, bool)

func Clip

func Clip[S ~[]E, E any](s S) S

func Clone

func Clone[S ~[]E, E any](s S) S

func Compact

func Compact[S ~[]E, E comparable](s S) S

func CompactFunc

func CompactFunc[S ~[]E, E any](s S, eq func(E, E) bool) S

func Compare

func Compare[S ~[]E, E cmp.Ordered](s1, s2 S) int

func CompareFunc

func CompareFunc[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, cmp func(E1, E2) int) int

func Contains

func Contains[S ~[]E, E comparable](s S, v E) bool

func ContainsFunc

func ContainsFunc[S ~[]E, E any](s S, f func(E) bool) bool

func Delete

func Delete[S ~[]E, E any](s S, i, j int) S

func DeleteFunc

func DeleteFunc[S ~[]E, E any](s S, del func(E) bool) S

func Equal

func Equal[S ~[]E, E comparable](s1, s2 S) bool

func EqualFunc

func EqualFunc[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, eq func(E1, E2) bool) bool

func Grow

func Grow[S ~[]E, E any](s S, n int) S

func Index

func Index[S ~[]E, E comparable](s S, v E) int

func IndexFunc

func IndexFunc[S ~[]E, E any](s S, f func(E) bool) int

func Insert

func Insert[S ~[]E, E any](s S, i int, v ...E) S

func IsSorted

func IsSorted[S ~[]E, E cmp.Ordered](x S) bool

func IsSortedFunc

func IsSortedFunc[S ~[]E, E any](x S, cmp func(a, b E) int) bool

func Max

func Max[S ~[]E, E cmp.Ordered](x S) E

func MaxFunc

func MaxFunc[S ~[]E, E any](x S, cmp func(a, b E) int) E

func Min

func Min[S ~[]E, E cmp.Ordered](x S) E

func MinFunc

func MinFunc[S ~[]E, E any](x S, cmp func(a, b E) int) E

func Replace

func Replace[S ~[]E, E any](s S, i, j int, v ...E) S

func Reverse

func Reverse[S ~[]E, E any](s S)

func Sort

func Sort[S ~[]E, E cmp.Ordered](x S)

func SortBy

func SortBy[A any, B cmp.Ordered](a []A, b []B)

func SortByFunc

func SortByFunc[A, B any](a []A, b []B, cmp func(B, B) int)

func SortFunc

func SortFunc[S ~[]E, E any](x S, cmp func(a, b E) int)

func SortStableFunc

func SortStableFunc[S ~[]E, E any](x S, cmp func(a, b E) int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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