unicmp

package module
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2025 License: MIT Imports: 6 Imported by: 1

README

unicmp

Universal ordering for comparable types

Documentation

Overview

Package unicmp provides generic ordering function for all comparable types.

The ordering is made by compares of one or more output of maphash function with different seeds. The resulting ordering is transitive and anticommutative, suitable for sorting and implementation of algorithms on top of sorted collections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmp added in v0.2.0

func Cmp[T comparable](x, y T) int

Cmp returns

-1 if x is less than y,
 0 if x equals y,
+1 if x is greater than y.

func Equal added in v0.2.0

func Equal[T comparable](x, y T) bool

Equal returns true if x == y.

func Less added in v0.2.0

func Less[T comparable](x, y T) bool

Less returns true if x sorts before y (x < y).

Types

This section is empty.

Jump to

Keyboard shortcuts

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