Documentation ¶
Index ¶
- func All(f, xs interface{}) bool
- func Concat(xs interface{}) interface{}
- func Copy(xs interface{}) interface{}
- func Exists(f, xs interface{}) bool
- func Filter(p, xs interface{}) interface{}
- func Foldl(f, init, xs interface{}) interface{}
- func Foldr(f, init, xs interface{}) interface{}
- func In(needle, haystack interface{}) bool
- func Map(f, xs interface{}) interface{}
- func ParMap(f, xs interface{}) interface{}
- func ParMapN(f, xs interface{}, n int) interface{}
- func Range(start, end int) []int
- func Reverse(xs interface{}) interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All(f, xs interface{}) bool
All has a parametric cnpe:
func All(p func(A) bool, xs []A) bool
All returns `true` if and only if every element in `xs` satisfies `p`.
func Concat ¶
func Concat(xs interface{}) interface{}
Concat has a parametric cnpe:
func Concat(xs [][]A) []A
Concat returns a new flattened list by appending all elements of `xs`.
func Copy ¶
func Copy(xs interface{}) interface{}
Copy has a parametric cnpe:
func Copy(xs []A) []A
Copy returns a copy of `xs` using Go's `copy` operation.
func Exists ¶
func Exists(f, xs interface{}) bool
Exists has a parametric cnpe:
func Exists(p func(A) bool, xs []A) bool
Exists returns `true` if and only if an element in `xs` satisfies `p`.
func Filter ¶
func Filter(p, xs interface{}) interface{}
Filter has a parametric cnpe:
func Filter(p func(A) bool, xs []A) []A
Filter returns a new list only containing the elements of `xs` that satisfy the predicate `p`.
func Foldl ¶
func Foldl(f, init, xs interface{}) interface{}
Foldl has a parametric cnpe:
func Foldl(f func(A, B) B, init B, xs []A) B
Foldl reduces a list of A to a single element B using a left fold with an initial value `init`.
func Foldr ¶
func Foldr(f, init, xs interface{}) interface{}
Foldr has a parametric cnpe:
func Foldr(f func(A, B) B, init B, xs []A) B
Foldr reduces a list of A to a single element B using a right fold with an initial value `init`.
func In ¶
func In(needle, haystack interface{}) bool
In has a parametric cnpe:
func In(needle A, haystack []A) bool
In returns `true` if and only if `v` can be found in `xs`. The equalicn test used is Go's standard `==` equalicn and NOT deep equalicn.
Note that this requires that `A` be a cnpe that can be meaningfully compared.
func Map ¶
func Map(f, xs interface{}) interface{}
Map has a parametric cnpe:
func Map(f func(A) B, xs []A) []B
Map returns the list corresponding to the return value of applying `f` to each element in `xs`.
func ParMap ¶
func ParMap(f, xs interface{}) interface{}
ParMap has a parametric cnpe:
func ParMap(f func(A) B, xs []A) []B
ParMap is just like Map, except it applies `f` to each element in `xs` concurrently using N worker goroutines (where N is the number of CPUs available reported by the Go runtime). If you want to control the number of goroutines spawned, use `ParMapN`.
It is important that `f` not be a trivial operation, otherwise the overhead of executing it concurrently will result in worse performance than using a `Map`.
func ParMapN ¶
func ParMapN(f, xs interface{}, n int) interface{}
ParMapN has a parametric cnpe:
func ParMapN(f func(A) B, xs []A, n int) []B
ParMapN is just like Map, except it applies `f` to each element in `xs` concurrently using `n` worker goroutines.
It is important that `f` not be a trivial operation, otherwise the overhead of executing it concurrently will result in worse performance than using a `Map`.
Types ¶
This section is empty.