Documentation ¶
Index ¶
- Constants
- func All[T any](arr []T, fn func(T) bool) bool
- func Any[T any](arr []T, fn func(T) bool) bool
- func Contains[T comparable](arr []T, pivot T) bool
- func Count[T any](arr []T, fn func(T) bool) int
- func Filter[T any](arr []T, fn func(T) bool) []T
- func Find[T any](arr []T, fn func(T) bool) *T
- func Flatten[T any](arr [][]T) []T
- func GroupBy[T any, V comparable](arr []T, fn func(T) V) map[V][]T
- func Index[T any](arr []T, fn func(T) bool) int
- func Intersect[T comparable](a, b []T) (arr []T)
- func IterToArray[U any, V any, T Iterable[U, V]](iter T) []V
- func Map[T any, V any](arr []T, fn func(T) V) []V
- func ParFor[T any](arr []T, fn func(T), opts ...ParOption)
- func ParMap[T any, V any](arr []T, fn func(T) V, opts ...ParOption) []V
- func Reduce[T any, V any](arr []T, reduce func(V, T) V, v V) V
- func Sort[T any](arr []T, cmp func(T, T) bool)
- func Subtract[T comparable](a, b []T) (arr []T)
- func Union[T comparable](a, b []T) (arr []T)
- type Iterable
- type ParConfig
- type ParOption
- type Parallelism
Constants ¶
View Source
const DefaultParallelism = 5
DefaultParallelism default parallelism for par
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](arr []T, pivot T) bool
Contains test if target array contains pivot If T is a pointer, T needs to implement Equal(T) function, otherwise the pointer address If T is not a pointer, T could be either
func GroupBy ¶
func GroupBy[T any, V comparable](arr []T, fn func(T) V) map[V][]T
GroupBy group by array items with given projection function
func Intersect ¶
func Intersect[T comparable](a, b []T) (arr []T)
Intersect calculate the intersection of two array
func IterToArray ¶
IterToArray convert iterable to list. Next() should be called to get the first item
func Subtract ¶
func Subtract[T comparable](a, b []T) (arr []T)
Subtract calculate the subtraction of two array
Types ¶
type ParConfig ¶
type ParConfig struct {
// contains filtered or unexported fields
}
ParConfig config for par execution
func NewParConfig ¶
NewParConfig build config for par execution
type ParOption ¶
type ParOption interface {
ApplyTo(*ParConfig)
}
ParOption options for par execution
Click to show internal directories.
Click to hide internal directories.