Documentation
¶
Index ¶
- func All[E any](s iter.Seq[E], f func(E) bool) bool
- func All2[K, V any](s iter.Seq2[K, V], f func(K, V) bool) bool
- func Any[E any](s iter.Seq[E], f func(E) bool) bool
- func Any2[K, V any](s iter.Seq2[K, V], f func(K, V) bool) bool
- func Cast[E any](s iter.Seq[any]) iter.Seq2[E, bool]
- func Chain[E any](seq1, seq2 iter.Seq[E]) iter.Seq[E]
- func Chain2[K, V any](seq1, seq2 iter.Seq2[K, V]) iter.Seq2[K, V]
- func Compare[E cmp.Ordered](x, y iter.Seq[E]) int
- func Compare2[K, V cmp.Ordered](x, y iter.Seq2[K, V]) int
- func CompareFunc[E any](x, y iter.Seq[E], f func(E, E) int) int
- func CompareFunc2[K, V any](x, y iter.Seq2[K, V], f func(K, V, K, V) int) int
- func Contains[E comparable](s iter.Seq[E], v E) bool
- func Contains2[K, V comparable](s iter.Seq2[K, V], k K, v V) bool
- func ContainsFunc[E any](s iter.Seq[E], f func(E) bool) bool
- func ContainsFunc2[K, V any](s iter.Seq2[K, V], f func(K, V) bool) bool
- func Empty[E any]() iter.Seq[E]
- func Empty2[K, V any]() iter.Seq2[K, V]
- func Enumerate[E any](s iter.Seq[E]) iter.Seq2[int, E]
- func Equal[E comparable](x, y iter.Seq[E]) bool
- func Equal2[K, V comparable](x, y iter.Seq2[K, V]) bool
- func EqualFunc[E any](x, y iter.Seq[E], f func(E, E) bool) bool
- func EqualFunc2[K, V any](x, y iter.Seq2[K, V], f func(K, V, K, V) bool) bool
- func Filter[E any](s iter.Seq[E], f func(E) bool) iter.Seq[E]
- func Filter2[K, V any](s iter.Seq2[K, V], f func(K, V) bool) iter.Seq2[K, V]
- func FilterMap[E1, E2 any](s iter.Seq[E1], f func(E1) (E2, bool)) iter.Seq[E2]
- func FilterMap2[K1, V1, K2, V2 any](s iter.Seq2[K1, V1], f func(K1, V1) (K2, V2, bool)) iter.Seq2[K2, V2]
- func First[E any](s iter.Seq[E]) (E, bool)
- func First2[K, V any](s iter.Seq2[K, V]) (K, V, bool)
- func FirstFunc[E any](s iter.Seq[E], f func(E) bool) (E, bool)
- func FirstFunc2[K, V any](s iter.Seq2[K, V], f func(K, V) bool) (K, V, bool)
- func FlatMap[E1, E2 any](s iter.Seq[E1], f func(E1) iter.Seq[E2]) iter.Seq[E2]
- func Flatten[E any](s iter.Seq[iter.Seq[E]]) iter.Seq[E]
- func Fold[E any, A any](s iter.Seq[E], init A, f func(A, E) A) A
- func Fold2[K, V, A any](s iter.Seq2[K, V], init A, f func(A, K, V) A) A
- func ForEach[E any](s iter.Seq[E], f func(E))
- func ForEach2[K, V any](s iter.Seq2[K, V], f func(K, V))
- func FromFunc[E any](f func() (E, bool)) iter.Seq[E]
- func FromFunc2[K, V any](f func() (K, V, bool)) iter.Seq2[K, V]
- func IsSorted[E cmp.Ordered](s iter.Seq[E]) bool
- func IsSortedFunc[E any](s iter.Seq[E], f func(E, E) int) bool
- func Join[E, K, V any](s iter.Seq2[K, V], f func(K, V) E) iter.Seq[E]
- func Last[E any](s iter.Seq[E]) (E, bool)
- func Last2[K, V any](s iter.Seq2[K, V]) (K, V, bool)
- func LastFunc[E any](s iter.Seq[E], f func(E) bool) (E, bool)
- func LastFunc2[K, V any](s iter.Seq2[K, V], f func(K, V) bool) (K, V, bool)
- func Map[E1, E2 any](s iter.Seq[E1], f func(E1) E2) iter.Seq[E2]
- func Map2[K1, V1, K2, V2 any](s iter.Seq2[K1, V1], f func(K1, V1) (K2, V2)) iter.Seq2[K2, V2]
- func MapWhile[E1, E2 any](s iter.Seq[E1], f func(E1) (E2, bool)) iter.Seq[E2]
- func MapWhile2[K1, V1, K2, V2 any](s iter.Seq2[K1, V1], f func(K1, V1) (K2, V2, bool)) iter.Seq2[K2, V2]
- func Max[E cmp.Ordered](s iter.Seq[E]) (E, bool)
- func MaxFunc[E any](s iter.Seq[E], cmp func(E, E) int) (E, bool)
- func Min[E cmp.Ordered](s iter.Seq[E]) (E, bool)
- func MinFunc[E any](s iter.Seq[E], cmp func(E, E) int) (E, bool)
- func Once[E any](e E) iter.Seq[E]
- func Once2[K, V any](k K, v V) iter.Seq2[K, V]
- func Position[E any](s iter.Seq[E], f func(E) bool) (int, bool)
- func Position2[K, V any](s iter.Seq2[K, V], f func(K, V) bool) (int, bool)
- func Range1[N integral](end N) iter.Seq[N]
- func Range2[N integral](start, end N) iter.Seq[N]
- func Range3[N integral](start, end, step N) iter.Seq[N]
- func Repeat[E any](e E) iter.Seq[E]
- func Repeat2[K, V any](k K, v V) iter.Seq2[K, V]
- func Size[E any](s iter.Seq[E]) int
- func Size2[K, V any](s iter.Seq2[K, V]) int
- func SizeFunc[E any](s iter.Seq[E], f func(E) bool) int
- func SizeFunc2[K, V any](s iter.Seq2[K, V], f func(K, V) bool) int
- func SizeValue[E comparable](s iter.Seq[E], v E) int
- func SizeValue2[K, V comparable](s iter.Seq2[K, V], k K, v V) int
- func Skip[E any](s iter.Seq[E], n int) iter.Seq[E]
- func Skip2[K, V any](s iter.Seq2[K, V], n int) iter.Seq2[K, V]
- func SkipWhile[E any](s iter.Seq[E], f func(E) bool) iter.Seq[E]
- func SkipWhile2[K, V any](s iter.Seq2[K, V], f func(K, V) bool) iter.Seq2[K, V]
- func Split[K, V, E any](s iter.Seq[E], f func(E) (K, V)) iter.Seq2[K, V]
- func Take[E any](s iter.Seq[E], n int) iter.Seq[E]
- func Take2[K, V any](s iter.Seq2[K, V], n int) iter.Seq2[K, V]
- func TakeWhile[E any](s iter.Seq[E], f func(E) bool) iter.Seq[E]
- func TakeWhile2[K, V any](s iter.Seq2[K, V], f func(K, V) bool) iter.Seq2[K, V]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cast ¶
Cast converts a sequence of any into a sequence of E values, returning the converted value and a success flag for each element.
func Compare ¶
Compare reports the comparison result between two comparable sequences. It returns:
- 0 if the sequences are equal
- -1 if the first sequence is "less" than the second
- 1 if the first sequence is "greater" than the second
func Compare2 ¶
Compare2 reports the comparison result between two comparable key/value sequences. It returns:
- 0 if the sequences are equal
- -1 if the first sequence is "less" than the second
- 1 if the first sequence is "greater" than the second
func CompareFunc ¶
CompareFunc compares two sequences using the provided comparison function. It returns:
- 0 if the sequences are equal
- -1 if the first sequence is "less" than the second
- 1 if the first sequence is "greater" than the second
func CompareFunc2 ¶
CompareFunc2 compares two key/value sequences using the provided comparison function. It returns:
- 0 if the sequences are equal
- -1 if the first sequence is "less" than the second
- 1 if the first sequence is "greater" than the second
func Contains ¶
func Contains[E comparable](s iter.Seq[E], v E) bool
Contains reports whether the sequence contains the specified comparable element.
func Contains2 ¶
func Contains2[K, V comparable](s iter.Seq2[K, V], k K, v V) bool
Contains2 reports whether the key/value sequence contains the specified key and value.
func ContainsFunc ¶
ContainsFunc reports whether the sequence contains an element that satisfies the predicate.
func Enumerate ¶
Enumerate returns a sequence of (index, element) tuples, adding an index for each element in the input sequence.
func Equal ¶
func Equal[E comparable](x, y iter.Seq[E]) bool
Equal reports whether two comparable sequences are equal (same length and values).
func Equal2 ¶
func Equal2[K, V comparable](x, y iter.Seq2[K, V]) bool
Equal2 reports whether two key/value sequences are equal (comparable keys and values must match).
func EqualFunc2 ¶
EqualFunc2 compares two key/value sequences using the provided comparison function.
func Filter2 ¶
Filter2 returns a new key/value sequence containing only pairs that satisfy the predicate.
func FilterMap ¶
FilterMap applies the provided function to each element, which returns a value and a boolean. Only values with a true boolean are kept.
func FilterMap2 ¶
func FilterMap2[K1, V1, K2, V2 any](s iter.Seq2[K1, V1], f func(K1, V1) (K2, V2, bool)) iter.Seq2[K2, V2]
FilterMap2 applies the provided function to each key/value pair, which returns a key, value, and boolean. Only pairs with a true boolean are kept.
func First ¶
First returns the first element of the sequence. If the sequence is empty, it returns the zero value and false.
func First2 ¶
First2 returns the first key/value pair of the sequence. If the sequence is empty, it returns the zero values and false.
func FirstFunc ¶
FirstFunc returns the first element that satisfies the predicate. If no such element exists, it returns the zero value and false.
func FirstFunc2 ¶
FirstFunc2 returns the first key/value pair that satisfies the predicate. If no such pair exists, it returns the zero values and false.
func FlatMap ¶
FlatMap applies the provided function to each element, which returns a sequence, and then flattens the result into a single sequence.
func Fold ¶
Fold reduces a sequence into a single value by applying the given function to each element.
func Fold2 ¶
Fold2 reduces a key/value sequence into a single value by applying the given function to each pair.
func ForEach ¶
ForEach applies the provided function to each element (no return value), typically for side effects such as printing or mutating external state.
func ForEach2 ¶
ForEach2 applies the provided function to each key/value pair (no return value), typically for side effects.
func FromFunc ¶
FromFunc generates a sequence from a function that returns (element, continue). The sequence ends when continue is false.
func FromFunc2 ¶
FromFunc2 generates a key/value sequence from a function that returns (key, value, continue). The sequence ends when continue is false.
func IsSortedFunc ¶
IsSortedFunc reports whether the sequence is sorted according to a consistent order (ascending or descending) using the provided comparison function.
func Join ¶
Join turns a key/value sequence into an element sequence using the provided mapping function.
func Last ¶
Last returns the last element of the sequence. If the sequence is empty, it returns the zero value and false.
func Last2 ¶
Last2 returns the last key/value pair of the sequence. If the sequence is empty, it returns the zero values and false.
func LastFunc ¶
LastFunc returns the last element that satisfies the predicate. If no such element exists, it returns the zero value and false.
func LastFunc2 ¶
LastFunc2 returns the last key/value pair that satisfies the predicate. If no such pair exists, it returns the zero values and false.
func Map ¶
Map applies the provided function to each element and returns a new sequence with the results.
func Map2 ¶
Map2 applies the provided function to each element of a key/value sequence and returns a new key/value sequence with the results.
func MapWhile ¶
MapWhile applies the provided function to each element and returns a new sequence with the results, until the function returns false.
func MapWhile2 ¶
func MapWhile2[K1, V1, K2, V2 any](s iter.Seq2[K1, V1], f func(K1, V1) (K2, V2, bool)) iter.Seq2[K2, V2]
MapWhile2 applies the provided function to each element of a key/value sequence and returns a new key/value sequence with the results, until the function returns false.
func Max ¶
Max returns the maximum element in the sequence using cmp.Compare. If the sequence is empty, it returns the zero value and false.
func MaxFunc ¶
MaxFunc returns the maximum element in the sequence using a custom compare function. If the sequence is empty, it returns the zero value and false.
func Min ¶
Min returns the minimum element in the sequence using cmp.Compare. If the sequence is empty, it returns the zero value and false.
func MinFunc ¶
MinFunc returns the minimum element in the sequence using a custom compare function. If the sequence is empty, it returns the zero value and false.
func Position2 ¶
Position2 returns the index of the first key/value pair that satisfies the predicate.
func Range3 ¶
Range3 generates an integer sequence from start to end-1 with a step size (end not included).
func SizeValue ¶
func SizeValue[E comparable](s iter.Seq[E], v E) int
SizeValue returns the number of elements equal to the specified value.
func SizeValue2 ¶
func SizeValue2[K, V comparable](s iter.Seq2[K, V], k K, v V) int
SizeValue2 returns the number of key/value pairs whose key and value equal the specified values.
func SkipWhile2 ¶
SkipWhile2 returns a key/value sequence that skips elements while the predicate holds.
func Split ¶
Split turns an element sequence into a key/value sequence using the provided split function.
Types ¶
This section is empty.