dict

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareMapIndex

func CompareMapIndex[A comparable, B constraints.Ordered](key A) Comparator[map[A]B]

func CompareMapIndexBy

func CompareMapIndexBy[A comparable, B any](key A, compare Comparator[B]) Comparator[map[A]B]

CompareMapIndexBy compares a single index

func CompareMapIndexOrd

func CompareMapIndexOrd[A comparable, B Ord[B]](key A) Comparator[map[A]B]

func CompareMapPairwise

func CompareMapPairwise[A constraints.Ordered, B constraints.Ordered]() Comparator[map[A]B]

func CompareMapPairwiseBy

func CompareMapPairwiseBy[A constraints.Ordered, B any](compare Comparator[B]) Comparator[map[A]B]

CompareMapPairwiseBy works by projecting a map to a list, therefore it's inefficient and probably

best to avoid using unless absolutely necessary!
Note: while `map` requires `A` to be `comparable`, *comparing* maps requires `A` to be Ordered
as well!

func CompareMapPairwiseOrd

func CompareMapPairwiseOrd[A constraints.Ordered, B Ord[B]]() Comparator[map[A]B]

func EqualMapIndex

func EqualMapIndex[A comparable, B comparable](key A) Equaler[map[A]B]

func EqualMapIndexBy

func EqualMapIndexBy[A comparable, B any](key A, equal Equaler[B]) Equaler[map[A]B]

EqualMapIndexBy equals a single index

func EqualMapIndexEq

func EqualMapIndexEq[A comparable, B Eq[B]](key A) Equaler[map[A]B]

func EqualMapPairwise

func EqualMapPairwise[A comparable, B comparable]() Equaler[map[A]B]

func EqualMapPairwiseBy

func EqualMapPairwiseBy[A comparable, B any](equal Equaler[B]) Equaler[map[A]B]

EqualMapPairwiseBy works by project a map to a list, therefore it's inefficient and probably

best to avoid using unless absolutely necessary!

func EqualMapPairwiseEq

func EqualMapPairwiseEq[A comparable, B Eq[B]]() Equaler[map[A]B]

func FromSliceBy

func FromSliceBy[A comparable, B any](merge func(B, B) B, ps []*Pair[A, B]) map[A]B

func Iterator added in v0.2.1

func Iterator[K comparable, V any](xs map[K]V) iterable.Iterator[*base.Pair[K, V]]

func KeysIterator added in v0.2.1

func KeysIterator[K comparable, V any](xs map[K]V) iterable.Iterator[K]

func Map

func Map[A comparable, B, C any](f func(B) C, xs map[A]B) map[A]C

func MapWithKey added in v0.2.0

func MapWithKey[A comparable, B, C any](f func(A, B) C, xs map[A]B) map[A]C

func Merge

func Merge[A comparable, B constraints.Ordered](m1 map[A]B, m2 map[A]B) map[A]B

func MergeBy

func MergeBy[A comparable, B any](resolve func(A, B, B) B, m1 map[A]B, m2 map[A]B) map[A]B

func MergeOrd

func MergeOrd[A comparable, B Ord[B]](m1 map[A]B, m2 map[A]B) map[A]B

func ToSlice

func ToSlice[A comparable, B any](m map[A]B) []*Pair[A, B]

func ValuesIterator added in v0.2.1

func ValuesIterator[K comparable, V any](xs map[K]V) iterable.Iterator[V]

Types

type Dict added in v0.2.1

type Dict[K comparable, V any] map[K]V

func (Dict[K, V]) Iterator added in v0.2.1

func (d Dict[K, V]) Iterator() iterable.Iterator[*base.Pair[K, V]]

Jump to

Keyboard shortcuts

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