Help us shape the future of Go! Take the 2026 Go Developer Survey

enumerables

package
v0.114.5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

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

func AreUnorderedEqual[T cmp.Ordered](a, b []T) bool

checks if two slices are equal, meaning they have the same elements regardless of order

func Filter

func Filter[T any](xs []T, predicate func(x T) bool) []T

inspiration: filter/2 https://elixir.hexdocs.pm/Enum.html#filter/2

func FlatMap

func FlatMap[T any, R any](xs []T, fn func(x T) []R) []R

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

func Map[T any, R any](xs []T, fn func(x T) R) []R

inspiration: map/2 https://elixir.hexdocs.pm/Enum.html#map/2

func MaxOf

func MaxOf[T any](xs []T, fn func(T) int) int

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.

Jump to

Keyboard shortcuts

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