Documentation
¶
Index ¶
- func Each(function func(T)) func([]T)
- func Each2(elements []T, function func(T))
- func Filter(predicate func(t Type) bool) func([]Type) []Type
- func Fold(combiner func(T, T) T) func([]T) T
- func Map(mapper func(t FromType) ToType) func([]FromType) []ToType
- func Permutations(elements []T) [][]T
- func Swap(a, b *T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Each ¶
func Each(function func(T)) func([]T)
Each applies the provided function to each element of slice.
func Each2 ¶
func Each2(elements []T, function func(T))
Each2 is the same as Each, but with single function call.
func Fold ¶
func Fold(combiner func(T, T) T) func([]T) T
Fold (also called Reduce) applies a combining operator to each element of the slice. Also see: https://en.wikipedia.org/wiki/Fold_(higher-order_function)
func Map ¶
func Map(mapper func(t FromType) ToType) func([]FromType) []ToType
Map takes a mapping function and applies it to each element of the slice, returning a new slice with the mapped elements.
func Permutations ¶
func Permutations(elements []T) [][]T
Permutations uses non-recursive Heap's algorithm to calculate all permutations of the provided input slice **eagerly**. The argument will not be manipulated. The result will be of size: factorial of number of input elements. See also: https://en.wikipedia.org/wiki/Heap%27s_algorithm
Types ¶
This section is empty.