Documentation
¶
Overview ¶
Package goitertools provides a collection iterator utilities inspired by Python's itertools library
Index ¶
- func Chain[T any](slices ...[]T) iter.Seq[T]
- func Compress[T any](items []T, selectors []bool) iter.Seq[T]
- func Count(start, step int) iter.Seq[int]
- func Cycle[T any](items []T) iter.Seq[T]
- func DropWhile[T any](items []T, condition func(int, T) bool) iter.Seq[T]
- func Filter[T any](items []T, condition func(int, T) bool) iter.Seq[T]
- func FilterFalse[T any](items []T, condition func(int, T) bool) iter.Seq[T]
- func Repeat[T any](value T, times int) iter.Seq[T]
- func TakeWhile[T any](items []T, condition func(int, T) bool) iter.Seq[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chain ¶
Chain returns an iterator that treats consecutive slices as a single continuous sequence. It yields all elements from the first slice, then the second, and so on, until all provided slices are exhausted.
func Compress ¶
Compress returns an iterator that filters elements returning only those that have a corresponding true value in the selectors. Iteration stops when either the 'items' or 'selectors' slice is exhausted.
func Count ¶
Count returns an infinite iterator that yields evenly spaced values starting. from the 'start', incrementing by 'step' on each iteration.
func Cycle ¶
Cycle returns an infinite iterator that repeatedly yields elements from the slice. It stops immediately if items is empty.
func DropWhile ¶
DropWhile returns an iterator that skips elements as long as the condition function returns true. Once the condition returns false, the and all remaining elements are yielded without further evaluation of the condition.
func Filter ¶
Filter returns an iterator that yields elements from the slice for which the condition function returns true. The condition function receives both the index and the value of the element.
func FilterFalse ¶
FilterFalse returns an iterator that yields elements from the slice for which the condition function returns false. The condition function receives both the index and the value of the element.
Types ¶
This section is empty.