Documentation
¶
Index ¶
- func All[T any](vs []T, fn func(T) bool) bool
- func Any[T any](vs []T, fn func(T) bool) bool
- func CoerceInt[N Numeric](val N) any
- func HasFraction(num float64) bool
- func MapList[T any](lst []T, fn func(T) bool) []T
- func MapMap[K comparable, V any](m map[K]V, fn func(K, V) bool) map[K]V
- func Member[T constraints.Ordered](ordered []T, elt T) bool
- func Number[V Numeric](val V) any
- func ValueOf(thing any) any
- type Numeric
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
Run predicate `fn` on all elems of `vs` and return true if all elems of `vs` match the predicate.
func Any ¶
Run predicate `fn` on all elems of `vs` and return true if any elems of `vs` match the predicate.
func MapList ¶
Map a function on all elements of a list returning a new list containing all the values from the initial list for which the function returns `true`.
func MapMap ¶
func MapMap[K comparable, V any](m map[K]V, fn func(K, V) bool) map[K]V
Apply a function on all key/value pairs in a map and return a new map of key/value pairs containing all elements for which the provided function returns `true`.
func Member ¶
func Member[T constraints.Ordered](ordered []T, elt T) bool
Returns true if the container specified by `ordered` contains the member specified by `elt`.
func ValueOf ¶
Attempt to ascertain the numeric value (if any) for a given thing.
If the type of `thing` is a floating-point number, then the value will be converted via `Number` to either an explicit float or to an integer type if there is no fraction.
If the type of `thing` is any other type, then it will be returned with no conversion.