Documentation ¶
Index ¶
- func Filter[I ~[]E, E any](i I, f func(E) bool) (o I)
- func Flatten[O []E, I ~[]O, E any](i I) (o O)
- func Last[I ~[]E, E any](i I) (e E)
- func Reduce[O any, I ~[]E, E any](i I, f func(O, E) O) (o O)
- func ToMap[O map[K]V, I ~[]E, K comparable, V, E any](i I, f func(E) (K, V)) (o O)
- func Transform[O []E2, I ~[]E1, E1, E2 any](i I, f func(E1) E2) (o O)
- func Zip[O []I, I ~[]E, E any](i ...I) O
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
Filter returns a new slice containing all of the elements for which the provided function returned true, in order.
func Flatten ¶
func Flatten[O []E, I ~[]O, E any](i I) (o O)
Flatten returns a new slice containing all of the elements, in order of the provided slice of slices.
func Last ¶
func Last[I ~[]E, E any](i I) (e E)
Last returns the last element of the provided slice, or the zero value of that type if the slice is empty.
func Reduce ¶
Reduce runs the provided function once for each element, in order, accumulating the result in `O`.
func ToMap ¶
func ToMap[O map[K]V, I ~[]E, K comparable, V, E any](i I, f func(E) (K, V)) (o O)
ToMap uses the provided function to transform the elements of the provided slice into a map.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.