util

package module
v0.0.0-...-0bc221f Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const NumberChars = "1234567890"

Variables

This section is empty.

Functions

func Abs

func Abs[T constraints.Signed](value T) T

func Accumulate

func Accumulate[T any](values []T, operation func(a T, b T) T) T

func All

func All[T any](values []T, predicate func(value T) bool) bool

func Any

func Any[T any](values []T, predicate func(value T) bool) bool

func Assert

func Assert(b bool, s string)

func BoolInt

func BoolInt(b bool) int

func ChunkIntSlice

func ChunkIntSlice(slice []int, chunkSize int) [][]int

func ConvertNumeric

func ConvertNumeric(s string) (i int)

func Filter

func Filter[T any](ss []T, test func(T) bool) (ret []T)

func GreatestCommonDivisor

func GreatestCommonDivisor(a, b interface{}) interface{}

func GreatestCommonDivisorF

func GreatestCommonDivisorF[T constraints.Floating](a, b T) T

func GreatestCommonDivisorI

func GreatestCommonDivisorI[T constraints.Integral](a, b T) T

func IntSliceContainsInt

func IntSliceContainsInt(slice []int, number int) bool

func LowestCommonMultiple

func LowestCommonMultiple(a, b interface{}) interface{}

func LowestCommonMultipleF

func LowestCommonMultipleF[T constraints.Floating](a, b T) T

func LowestCommonMultipleI

func LowestCommonMultipleI[T constraints.Integral](a, b T) T

func LowestCommonMultipleSlice

func LowestCommonMultipleSlice(numbers []int) int

func MapKeys

func MapKeys[M ~map[K]V, K comparable, V any](m M) (keys []K)

func MapStringsToIntegers

func MapStringsToIntegers(ss []string) []int

func MapValues

func MapValues[M ~map[K]V, K comparable, V any](m M) (values []V)

func None

func None[T any](values []T, predicate func(value T) bool) bool

func PanicOnError

func PanicOnError(err error)

func Transform

func Transform[T any, U any](values []T, operation func(item T) U) []U

func TransformWithIndex

func TransformWithIndex[T any, U any](values []T, operation func(item T, index int) U) []U

Types

type CopyableMap

type CopyableMap map[string]interface{}

func (CopyableMap) DeepCopy

func (m CopyableMap) DeepCopy() map[string]interface{}

DeepCopy will create a deep copy of this map. The depth of this copy is all-inclusive. Both maps and slices will be considered when making the copy.

type CopyableSlice

type CopyableSlice []interface{}

func (CopyableSlice) DeepCopy

func (s CopyableSlice) DeepCopy() []interface{}

DeepCopy will create a deep copy of this slice. The depth of this copy is all-inclusive. Both maps and slices will be considered when making the copy.

type Interval

type Interval struct {
	Start int
	Final int
}

func (Interval) Invalid

func (i Interval) Invalid() bool

func (Interval) Length

func (i Interval) Length() int

type TestExample

type TestExample struct {
	Input    string
	Expected string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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