Documentation
¶
Index ¶
- func All[T comparable](xs []T, target T) bool
- func Any[T comparable](xs []T, target T) bool
- func AreSetEqual[T comparable](a, b []T) bool
- func AreStrictlyEqual[T comparable](a, b []T) bool
- func AreUnorderedEqual[T cmp.Ordered](a, b []T) bool
- func Filter[T any](xs []T, predicate func(x T) bool) []T
- func FlatMap[T any, R any](xs []T, fn func(x T) []R) []R
- func GroupBy[T any, K comparable](xs []T, keyFn func(x T) K) map[K][]T
- func HasKey[K comparable, V any](m map[K]V, key K) bool
- func KeyBy[T any, K comparable](xs []T, keyFn func(x T) K) map[K]T
- func Map[T any, R any](xs []T, fn func(x T) R) []R
- func MaxOf[T any](xs []T, fn func(T) int) int
- func ToMap[T any, K comparable, V any](xs []T, keyFn func(x T) K, valueFn func(x T) V) map[K]V
- func ToSet[T any, K comparable](xs []T, keyFn func(x T) K) map[K]struct{}
- func Uniq[T comparable](xs []T) []T
- func UniqBy[T any, K comparable](xs []T, fn func(x T) K) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All[T comparable](xs []T, target T) bool
func Any ¶
func Any[T comparable](xs []T, target T) bool
func AreSetEqual ¶
func AreSetEqual[T comparable](a, b []T) bool
checks if two slices are equal as sets, meaning they have the same unique elements regardless of order and duplicates
func AreStrictlyEqual ¶
func AreStrictlyEqual[T comparable](a, b []T) bool
checks if two slices are strictly equal, meaning they have the same elements in the same order
func AreUnorderedEqual ¶
checks if two slices are equal, meaning they have the same elements regardless of order
func Filter ¶
inspiration: filter/2 https://elixir.hexdocs.pm/Enum.html#filter/2
func FlatMap ¶
inspiration: flat_map/2 https://elixir.hexdocs.pm/Enum.html#flat_map/2
func GroupBy ¶
func GroupBy[T any, K comparable](xs []T, keyFn func(x T) K) map[K][]T
inspiration: group_by/3 https://elixir.hexdocs.pm/Enum.html#group_by/3
func HasKey ¶
func HasKey[K comparable, V any](m map[K]V, key K) bool
inspiration: Map.has_key?/2 https://elixir.hexdocs.pm/Map.html#has_key?/2
func KeyBy ¶
func KeyBy[T any, K comparable](xs []T, keyFn func(x T) K) map[K]T
func Map ¶
inspiration: map/2 https://elixir.hexdocs.pm/Enum.html#map/2
func MaxOf ¶
inspiration: max/3 https://elixir.hexdocs.pm/Enum.html#max/3
func ToMap ¶
func ToMap[T any, K comparable, V any](xs []T, keyFn func(x T) K, valueFn func(x T) V) map[K]V
func ToSet ¶
func ToSet[T any, K comparable](xs []T, keyFn func(x T) K) map[K]struct{}
inspiration: MapSet.new/2 https://elixir.hexdocs.pm/MapSet.html#new/2
func Uniq ¶
func Uniq[T comparable](xs []T) []T
inspiration: uniq/1 https://elixir.hexdocs.pm/Enum.html#uniq/1
func UniqBy ¶
func UniqBy[T any, K comparable](xs []T, fn func(x T) K) []T
inspiration: uniq_by/2 https://elixir.hexdocs.pm/Enum.html#uniq_by/2
Types ¶
This section is empty.