Documentation ¶
Index ¶
- func Accumulate[A any](scope incr.Scope, from incr.Incr[A], fn func([]A, A) []A) incr.Incr[[]A]
- func AccumulateSorted[A any](scope incr.Scope, from incr.Incr[A], f SortFunc[A]) incr.Incr[[]A]
- func Asc[A ~int | ~uint | ~float64 | ~string](testValue, newValue A) int
- func Desc[A ~int | ~uint | ~float64 | ~string](testValue, newValue A) int
- func Filter[A any](g incr.Scope, input incr.Incr[[]A], pred func(A) bool) incr.Incr[[]A]
- func First[A any](scope incr.Scope, input incr.Incr[[]A]) incr.Incr[A]
- func Last[A any](scope incr.Scope, input incr.Incr[[]A]) incr.Incr[A]
- func Sort[A any](scope incr.Scope, input incr.Incr[[]A], fn SortFunc[A]) incr.Incr[[]A]
- func TakeFirst[A any](scope incr.Scope, input incr.Incr[[]A], count int) incr.Incr[[]A]
- func TakeFirstSearch[A any](scope incr.Scope, input incr.Incr[[]A], fn func(A) bool) incr.Incr[[]A]
- func TakeLast[A any](scope incr.Scope, input incr.Incr[[]A], count int) incr.Incr[[]A]
- func TakeLastSearch[A any](scope incr.Scope, input incr.Incr[[]A], fn func(A) bool) incr.Incr[[]A]
- type SortFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Accumulate ¶
func Accumulate[A any](scope incr.Scope, from incr.Incr[A], fn func([]A, A) []A) incr.Incr[[]A]
Accumulate returns an incremental that accepts new values from an input incremental and returns an array of those values based on the result of a function.
You can use this function to sort the values, filter the values, or to simply append.
func AccumulateSorted ¶
AccumulateSorted returns a new incremental that continually sorts new values into an output array using an online insertion sort.
func First ¶
func First[A any](scope incr.Scope, input incr.Incr[[]A]) incr.Incr[A]
First returns the first element from an incremental that is typed as an array.
func Last ¶
func Last[A any](scope incr.Scope, input incr.Incr[[]A]) incr.Incr[A]
Last returns the last element from an incremental that is typed as an array.
func TakeFirst ¶
TakeFirst returns the first count elements from an incremental that is typed as an array.
func TakeFirstSearch ¶
TakeFirstSearch returns the elements before a point determined by a search function.
The requirement for the input incremental is that it should already be sorted.
The function should return true for elements you would like to skip, and the first element that returns false is the one that will mark the end of the list.
An example sort function might be:
func(v int) bool { return v >= 5 }
For a list of `[]int{0,1,2,3,4,5,6,7,8,9}` this will return `[]int{0,1,2,3,4}`.
func TakeLastSearch ¶
TakeLastSearch returns the elements after a point determined by a search function.
The requirement for the input incremental is that it should already be sorted.
The function should return true for elements you would like to skip, and the first element that returns false is the one that will mark the beginning of the list.
An example sort function might be:
func(v int) bool { return v > 5 }
For a list of `[]int{0,1,2,3,4,5,6,7,8,9}` this will return `[]int{6,7,8,9}`.