multiless

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MPL-2.0 Imports: 1 Imported by: 15 modules, 38 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Computation

type Computation struct {
	// contains filtered or unexported fields
}

A helper for long chains of "less-than" comparisons, where later comparisons are only required if earlier ones haven't resolved the comparison.

func EagerOrdered deprecated

func EagerOrdered[T constraints.Ordered](start Computation, l, r T) Computation

Applies builtin ordering if necessary.

Deprecated: Use Computation.Compare (requires Go 1.27).

func New

func New() Computation

func (Computation) AndThen

func (me Computation) AndThen(then Computation) Computation

func (Computation) Bool

func (me Computation) Bool(l, r bool) Computation

Sorts so that false comes before true.

func (Computation) Cmp deprecated

func (me Computation) Cmp(i int) Computation

Deprecated: Use Computation.Then.

func (Computation) CmpInt64

func (me Computation) CmpInt64(i int64) Computation

func (Computation) Compare added in v0.5.0

func (me Computation) Compare[T constraints.Ordered](l, r T) Computation

Compare applies the builtin ordering of l and r if the computation isn't decided yet. Unlike Computation.Then, which takes the result of a three-way comparison, it takes the two values. Unlike cmp.Compare, a NaN operand doesn't sort first: it decides the computation as not less.

func (Computation) EagerSameLess

func (me Computation) EagerSameLess(same, less bool) Computation

func (Computation) Float64 deprecated

func (me Computation) Float64(l, r float64) Computation

Deprecated: Use Computation.Compare (requires Go 1.27).

func (Computation) Int deprecated

func (me Computation) Int(l, r int) Computation

Deprecated: Use Computation.Compare (requires Go 1.27).

func (Computation) Int64 deprecated

func (me Computation) Int64(l, r int64) Computation

Deprecated: Use Computation.Compare (requires Go 1.27).

func (Computation) Lazy

func (me Computation) Lazy(f func() Computation) Computation

func (Computation) LazySameLess

func (me Computation) LazySameLess(lazy func() (same, less bool)) Computation

func (Computation) Less

func (me Computation) Less() bool

func (Computation) LessOk

func (me Computation) LessOk() (less, ok bool)

func (Computation) MustLess

func (me Computation) MustLess() bool

func (Computation) Ok

func (me Computation) Ok() bool

func (Computation) OrderingInt

func (me Computation) OrderingInt() int

Returns -1 if less, 0 if equal, and 1 if greater than

func (Computation) Then added in v0.5.0

func (me Computation) Then(i int) Computation

Then applies the sign of a three-way comparison result, such as from cmp.Compare, bytes.Compare or time.Time.Compare, if the computation isn't decided yet: negative is less, positive is greater, and zero leaves it undecided. It's named after Rust's Ordering::then.

func (Computation) Uint32 deprecated

func (me Computation) Uint32(l, r uint32) Computation

Deprecated: Use Computation.Compare (requires Go 1.27).

func (Computation) Uint64 deprecated

func (me Computation) Uint64(l, r uint64) Computation

Deprecated: Use Computation.Compare (requires Go 1.27).

func (Computation) Uintptr deprecated

func (me Computation) Uintptr(l, r uintptr) Computation

Deprecated: Use Computation.Compare (requires Go 1.27).

Jump to

Keyboard shortcuts

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