sort

package
v0.0.0-...-c1b4e3e Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: GPL-3.0, LGPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSorted

func IsSorted[E types.Ordered](vals []E) bool

IsSorted checks if any ordered-typed slice is sorted.

func Number

func Number[E types.Number](vals []E)

Number sorts slice of any numeric type (signed/unsigned, integer/float).

func Ordered

func Ordered[E types.Ordered](vals []E)

Ordered sorts in-place a slice of any ordered-type elements, including any numbers and strings.

func Slice

func Slice[E any](vals []E, less func(i, j int) bool)

Slice is the generic variant for general slice sorting.

func String

func String[E ~string](vals []E)

String sorts a slice of any type rooted in `string`.

func StringSet

func StringSet(set map[string]struct{}) []string

StringSet sorts the keys in a set (a map[string]struct{}) in lexicographical order. TODO add parametric type

Types

This section is empty.

Jump to

Keyboard shortcuts

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