Documentation ¶
Index ¶
- func ExitFatal(err error)
- func ExitIfError[T any](v T, err error) T
- func FilterMap[K comparable, V any](m map[K]V, cb func(k K, v V) bool) map[K]V
- func FilterSlice[T any](s []T, cb func(i int, v T) bool) []T
- func LoadInput(fname string) (input []byte, err error)
- func Map[T any, M any](s []T, cb func(i int, v T) M) []M
- func MapContains[K comparable, V comparable](m map[K]V, v V) bool
- func MapKeys[K comparable, V any](m map[K]V) []K
- func MapVals[K comparable, V any](m map[K]V) []V
- func Max[T cmp.Ordered](vals ...T) T
- func Min[T cmp.Ordered](vals ...T) T
- func PrintMap[K comparable, V any](m map[K]V)
- func PrintSlice[T any](s []T)
- func SliceContains[T comparable](s []T, v T) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExitIfError ¶
func FilterMap ¶
func FilterMap[K comparable, V any](m map[K]V, cb func(k K, v V) bool) map[K]V
Iterates over the input map, passing the key and value to the callback function for each iteration. Returns a new map containing only key+value pairs that pass the callback predicate (return true)
func FilterSlice ¶
Iterates over the input slice, passing the index and value to the callback function for each iteration. Returns a new slice containing only values that pass the callback predicate (return true)
func Map ¶
Iterates over the input array, passing the index and value to the callback function for each iteration. Returns a new array built from the return values of the callback function.
func MapContains ¶
func MapContains[K comparable, V comparable](m map[K]V, v V) bool
Iterates over a map to see if the given value exists within the map.
func MapKeys ¶
func MapKeys[K comparable, V any](m map[K]V) []K
Returns a slice containing all keys of the given map
func MapVals ¶
func MapVals[K comparable, V any](m map[K]V) []V
Returns a slice containing all values of the given map
func PrintMap ¶
func PrintMap[K comparable, V any](m map[K]V)
func PrintSlice ¶
func PrintSlice[T any](s []T)
func SliceContains ¶
func SliceContains[T comparable](s []T, v T) bool
Iterates over a slice to see if the given value exists within the slice.
Types ¶
This section is empty.