compare

package
v0.0.0-...-24ca9bf Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InterfaceEqual

func InterfaceEqual(a, b interface{}) bool

InterfaceEqual protects against panics from doing equality tests on two interfaces with non-comparable underlying types. adapted from:

/usr/local/go/src/os/exec/exec.go (go 1.15.6)

func Max

func Max[T Ordered](a, b T) T

Max returns the item that is greater as defined by the constraint type T. T must be an Ordered data type or

func MaxSet

func MaxSet[T Ordered](v ...T) T

MaxSet returns the maximum value in a set of values.

func Min

func Min[T Ordered](a, b T) T

func MinMax

func MinMax[T Ordered](a, b T) (T, T)

MinMax returns the min and max of the two inputs in increasing order, i.e. the min is the first return value and the max is the second. If the inputs are equal, the the order is maintained.

func MinSet

func MinSet[T Ordered](v ...T) T

MinSet returns the minimum value in a set of values.

func Sort

func Sort[T Ordered](v ...T) []T

Sort returns a sorted list from a list of values.

Types

type Ordered

type Ordered constraints.Ordered

Jump to

Keyboard shortcuts

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