Documentation ¶
Index ¶
- func CmpNoOrder[E comparable, S ~[]E](a, b S) bool
- func DeleteFunc[S ~[]E, E any](s S, del func(E) bool) S
- func IndexFunc[S ~[]E, E any](s S, f func(E) bool) int
- func Map[From any, To any, S ~[]From](s S, mapFunc func(*From) To) []To
- func OrderStringSlices(a, b []string) int
- func Pick[E any, S ~[]E](s S, keep func(*E) bool) S
- func ToMap[K comparable, V any, S ~[]E, E any](s S, mf func(int) (K, V)) map[K]V
- func ToRefMap[K comparable, S ~[]E, E any](s S, key func(*E) K) map[K]*E
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CmpNoOrder ¶ added in v0.5.0
func CmpNoOrder[E comparable, S ~[]E](a, b S) bool
CmpNoOrder returns true if the two provided slices have the same elements regardless of their order.
func DeleteFunc ¶ added in v0.10.0
DeleteFunc removes any elements from s for which del returns true, returning the modified slice. DeleteFunc zeroes the elements between the new length and the original length.
func IndexFunc ¶ added in v0.10.0
IndexFunc returns the first index i satisfying f(s[i]), or -1 if none do.
func Map ¶
Map creates a new slice with the same number elements as the input s with the values generated by mapFunc
func OrderStringSlices ¶ added in v0.10.0
func Pick ¶ added in v0.6.1
Pick creates a new slice containing only the elements for which keep return true.
func ToMap ¶
func ToMap[K comparable, V any, S ~[]E, E any](s S, mf func(int) (K, V)) map[K]V
ToMap creates a map[K]V out of the provided slice s using mf() to get the key and value for a given index i.
The caller can compare the length of the map to the one of the slice in order to detect potential key conflicts.
func ToRefMap ¶
func ToRefMap[K comparable, S ~[]E, E any](s S, key func(*E) K) map[K]*E
ToRefMap creates a map[K]*S out of the provided slice s []S using key() to create the map keys.
The caller can compare the length of the map to the one of the slice in order to detect potential key conflicts.
Types ¶
This section is empty.