ick

package
v0.0.0-...-e714f23 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Atoi

func Atoi(s string) int

func CSort

func CSort[V constraints.Ordered](av []V) []V

CSort sorts a copy of the data and returns the updated copy. (This should probably be renamed Sort?)

func ChompNL

func ChompNL(line string) string

func DuplicateSlice

func DuplicateSlice[V any](av []V) []V

func Grep

func Grep[T any](predicate func(T) bool, in []T) []T

Like perl's grep.

func IsEmptyArray

func IsEmptyArray[T any](t []T) bool

func IsEmptyString

func IsEmptyString(s string) bool

func Keys

func Keys[K comparable, V any](m map[K]V) []K

func MapSlice

func MapSlice[T, U any](fn func(T) U, ts []T) []U

MapSlice is the moral equivalent of Lisp's mapcar. It is not used in the presence of polite company by Go programmers, who just write a for loop.

func Max

func Max[V Numeric](av []V) V

func Min

func Min[T constraints.Ordered](ts []T) T

:-(

func Must

func Must[T any](t T, err error) T

Must extracts the value from a two-argument return and dies if there's an error.

func NReverse

func NReverse[T any](a []T)

Reverse, in place.

func New2DArray

func New2DArray[T any](n, m int) [][]T

func New2DArrayWithDefault

func New2DArrayWithDefault[T any](n, m int, def T) [][]T

func Not

func Not[T any](predicate func(T) bool) func(T) bool

func Product

func Product[V Numeric](av []V) V

https://go.dev/doc/tutorial/generics

func ReadBlankLineSeparatedBlocks

func ReadBlankLineSeparatedBlocks(reader io.Reader) ([][]string, error)

func ReadJustOneLine

func ReadJustOneLine(reader io.Reader) (string, error)

func ReadLines

func ReadLines(reader io.Reader) ([]string, error)

func Reverse

func Reverse[T any](a []T) []T

Reverse, not in place.

func Shuffle

func Shuffle[T any](t []T)

func Sort

func Sort[V constraints.Ordered](av []V)

Sort sorts the data in place. (This should be renamed QSort?)

func Sum

func Sum[V Numeric](av []V) V

https://go.dev/doc/tutorial/generics

func Values

func Values[K comparable, V any](m map[K]V) []V

Types

type Numeric

type Numeric interface {
	int | int32 | int64 | float64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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