dict

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareIndex added in v0.2.9

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

func CompareIndexBy added in v0.2.9

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

CompareIndexBy compares a single index

func CompareIndexOrd added in v0.2.9

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

func ComparePairwise added in v0.2.9

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

func ComparePairwiseBy added in v0.2.9

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

ComparePairwiseBy 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 ComparePairwiseOrd added in v0.2.9

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

func EqualIndex added in v0.2.9

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

func EqualIndexBy added in v0.2.9

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

EqualIndexBy equals a single index

func EqualIndexEq added in v0.2.9

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

func EqualPairwise added in v0.2.9

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

func EqualPairwiseBy added in v0.2.9

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

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

best to avoid using unless absolutely necessary!

func EqualPairwiseEq added in v0.2.9

func EqualPairwiseEq[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 Keys added in v0.3.0

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

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 Values added in v0.3.0

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

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