maths

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 1 Imported by: 0

README

maths

Generic arithmetic operations.
Because sometimes a single line is easier to grok.

Documentation

Overview

Package maths provides generic arithmetic operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Choose added in v0.5.0

func Choose[V any](ok bool, yes, no V) V

Choose will return yes when ok is true, and no when ok is false.

func ChooseFunc added in v0.5.0

func ChooseFunc[V any](ok bool, yes, no func() V) V

ChooseFunc will evaluate and return yes when ok is true, and no when ok is false.

func ChooseFuncE added in v0.5.0

func ChooseFuncE[V any](ok bool, yes, no func() (V, error)) (V, error)

ChooseFuncE will evaluate and return yes when ok is true, and no when ok is false.

func Max

func Max[X cmp.Ordered](a, b X) X

Max returns the greatest value.

func MaxOf

func MaxOf[X cmp.Ordered](a X, bb ...X) X

MaxOf returns the greatest value.

func Min

func Min[X cmp.Ordered](a, b X) X

Min returns the least value.

func MinOf

func MinOf[X cmp.Ordered](a X, bb ...X) X

MinOf returns the least value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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