utils

package
v0.0.0-...-e16adcf Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsInt

func AbsInt[T Integer](x T) T

func Choices

func Choices[T any](collection [][]T) [][]T

func ExtGCD

func ExtGCD[I Integer](a, b I) (I, I, I)

func ExtLCM

func ExtLCM[I Integer](mu []I, lambda []I) (I, I)

func GCD

func GCD[I Integer](a, b I) I

func IPow

func IPow[I Integer](a, b I) I

func ISqrt

func ISqrt[T Integer](x T) T

func LCM

func LCM[I Integer](a, b I, integers ...I) I

find Least Common Multiple (LCM) via GCD

func LineCounter

func LineCounter(r *os.File) (int, error)

func Permute

func Permute[T any, S []T](s S) []S

func SliceDifference

func SliceDifference[T comparable](a, b []T) []T

func SortedMerge

func SortedMerge[T cmp.Ordered](a, b []T) []T

func SortedUniqueInsert

func SortedUniqueInsert[T cmp.Ordered](x []T, e T) ([]T, bool)

Types

type Integer

type Integer interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

Jump to

Keyboard shortcuts

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