Documentation ¶
Index ¶
- func Difference[I ~map[K]V, K comparable, V any](a, b I) I
- func Disjoint[I ~map[K]V, K comparable, V any](a, b I) I
- func Filter[I ~map[K]V, K comparable, V any](i I, f func(K, V) bool) I
- func Intersect[O map[K][]V, I ~map[K]V, K comparable, V any](i ...I) O
- func Keys[O []K, I ~map[K]V, K comparable, V any](i I) O
- func MapMapInsert[I ~map[K]I2, I2 ~map[K2]V, K, K2 comparable, V any](i I, k K, k2 K2, v V)
- func Range[IM ~map[K]V, IK ~[]K, K comparable, V any](i IM, keys IK, f func(K, V) error) error
- func Reduce[O any, I ~map[K]V, K comparable, V any](i I, f func(O, K, V) O) (o O)
- func SortedRange[I ~map[K]V, K cmp.Ordered, V any](i I, f func(K, V) error) error
- func SortedRangeFunc[I ~map[K]V, K comparable, V any](i I, sortF func(x, y K) int, rangeF func(K, V) error) error
- func Subset[I ~map[K]V, K comparable, V any](a, b I) bool
- func ToSlice[O []E, I ~map[K]V, K comparable, V, E any](i I, f func(K, V) E) (o O)
- func Transform[O map[K2]V2, I ~map[K1]V1, K1, K2 comparable, V1, V2 any](i I, f func(K1, V1) (K2, V2)) (o O)
- func Union[O map[K][]V, I ~map[K]V, K comparable, V any](i ...I) O
- func Values[O []V, I ~map[K]V, K comparable, V any](i I) O
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Difference ¶
func Difference[I ~map[K]V, K comparable, V any](a, b I) I
Difference returns the elements of `a` that are not present in `b` as a new map.
func Disjoint ¶
func Disjoint[I ~map[K]V, K comparable, V any](a, b I) I
Disjoint returns the disjoint of `a` and `b` as a new map.
func Filter ¶
func Filter[I ~map[K]V, K comparable, V any](i I, f func(K, V) bool) I
Filter returns a new map containing all of the key-value pairs for which the provided function returned true.
func Intersect ¶
func Intersect[O map[K][]V, I ~map[K]V, K comparable, V any](i ...I) O
Intersect returns the intersection of the provided maps. The values will be a slice of the values for that key, in order of the provided maps.
func Keys ¶
func Keys[O []K, I ~map[K]V, K comparable, V any](i I) O
Keys returns the keys of the provided map as a slice in no particular order.
func MapMapInsert ¶
func MapMapInsert[I ~map[K]I2, I2 ~map[K2]V, K, K2 comparable, V any](i I, k K, k2 K2, v V)
MapMapInsert inserts the provided value into the inner map of the provided map of maps. If the inner map is nil, it will be initialised first.
func Range ¶
func Range[IM ~map[K]V, IK ~[]K, K comparable, V any](i IM, keys IK, f func(K, V) error) error
Range runs the provided function once for each key-value pair in the provided map, in order of the provided keys.
func Reduce ¶
func Reduce[O any, I ~map[K]V, K comparable, V any](i I, f func(O, K, V) O) (o O)
Reduce runs the provided function once for each key-value pair, accumulating the result in `O`.
func SortedRange ¶
SortedRange runs the provided function once for each key-value pair in the provided map, in ascending order of keys.
func SortedRangeFunc ¶
func SortedRangeFunc[I ~map[K]V, K comparable, V any](i I, sortF func(x, y K) int, rangeF func(K, V) error) error
SortedRangeFunc runs the provided range function once for each key-value pair in the provided map, in ascending order of keys as determined by the provided sort function.
func Subset ¶
func Subset[I ~map[K]V, K comparable, V any](a, b I) bool
Subset returns whether `a` is a subset of `b`.
func ToSlice ¶
func ToSlice[O []E, I ~map[K]V, K comparable, V, E any](i I, f func(K, V) E) (o O)
ToSlice uses the provided function to transform the key-value pairs of the provided map into a slice.
func Transform ¶
func Transform[O map[K2]V2, I ~map[K1]V1, K1, K2 comparable, V1, V2 any](i I, f func(K1, V1) (K2, V2)) (o O)
Transform uses the provided function to transform the key-value pairs of the provided map into a new map.
func Union ¶
func Union[O map[K][]V, I ~map[K]V, K comparable, V any](i ...I) O
Union returns the union of provided maps. The values will be a slice of the values for that key, in order of the provided maps.
func Values ¶
func Values[O []V, I ~map[K]V, K comparable, V any](i I) O
Values returns the values of the provided map as a slice in no particular order.
Types ¶
This section is empty.