slice

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[T any](slice []T, fn func(T) (bool, error)) (result []T, err error)

Filter returns a new slice containing only the elements of the given slice for which the given function returns true.

func Map

func Map[TIn any, TOut any](slice []TIn, fn func(TIn) (TOut, error)) (result []TOut, err error)

Map returns a new slice with the results of applying the given function to each element of the given slice.

func Reverse

func Reverse[T generics.LTGTConstraint](slice []T) error

Reverse sorts the given slice in descending order. The type parameter must be a native number type.

func Sort

func Sort[T generics.LTGTConstraint](slice []T) error

Sort sorts the given slice in ascending order. The type parameter must be a native number type.

func SortF

func SortF[T any](slice []T, fn func(T, T) (bool, error)) error

SortF sorts the given slice using the given function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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