Documentation ¶
Overview ¶
Package giopt provides a set of generic iterator combinators over scalar values iter.Seq adapted for optval.Value.
Index ¶
- func FilterMap[V, R any, F func(V) optval.Value[R]](values iter.Seq[V], f F) iter.Seq[R]
- func FilterMapWith[V, R any, F func(V) optval.Value[R]](f F) func(values iter.Seq[V]) iter.Seq[R]
- func Find[V any, P constraints.Predicate[V]](values iter.Seq[V], predicate P) optval.Value[V]
- func FindWith[V any, P constraints.Predicate[V]](predicate P) func(iter.Seq[V]) optval.Value[V]
- func Max[V constraints.Ordered](values iter.Seq[V]) optval.Value[V]
- func MaxBy[V any, K constraints.Ordered, F ~func(V) K](values iter.Seq[V], key F) optval.Value[V]
- func MaxByCompare[V constraints.OrderedByCompare[V]](values iter.Seq[V]) optval.Value[V]
- func MaxByCompareFunc[V any, F ~func(V, V) int](values iter.Seq[V], compare F) optval.Value[V]
- func MaxByLess[V constraints.OrderedByLess[V]](values iter.Seq[V]) optval.Value[V]
- func MaxByLessFunc[V any, F ~func(V, V) bool](values iter.Seq[V], less F) optval.Value[V]
- func Min[V constraints.Ordered](values iter.Seq[V]) optval.Value[V]
- func MinBy[V any, K constraints.Ordered, F ~func(V) K](values iter.Seq[V], key F) optval.Value[V]
- func MinByCompare[V constraints.OrderedByCompare[V]](values iter.Seq[V]) optval.Value[V]
- func MinByCompareFunc[V any, F ~func(V, V) int](values iter.Seq[V], compare F) optval.Value[V]
- func MinByLess[V constraints.OrderedByLess[V]](values iter.Seq[V]) optval.Value[V]
- func MinByLessFunc[V any, F ~func(V, V) bool](values iter.Seq[V], less F) optval.Value[V]
- func Reduce[V any, F ~func(V, V) V](values iter.Seq[V], accumulate F) optval.Value[V]
- func ReduceWith[V any, F ~func(V, V) V](accumulate F) func(iter.Seq[V]) optval.Value[V]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterMap ¶
FilterMap returns an iterator that yields values by applying the provided filter-map function to values. The filter-map function returns an optional value. If the optional value is empty, the value is skipped.
func FilterMapWith ¶
FilterMapWith returns a function that can be used to filter-map sequences of values. It uses the provided filter-map function to transform and filter values. If the optional value is empty, the value is skipped.
func FindWith ¶
FindWith returns a function that finds the first value among the values matching the predicate.
func Max ¶
Max returns the maximum value of the given values or optval.None if values is empty.
func MaxBy ¶
MaxBy returns the maximum value of the given values or optval.None if values is empty. It uses provided key function for comparison.
func MaxByCompare ¶
func MaxByCompare[V constraints.OrderedByCompare[V]](values iter.Seq[V]) optval.Value[V]
MaxByCompare returns the maximum value of the given values or optval.None if values is empty. It uses Compare method for comparison.
func MaxByCompareFunc ¶
MaxByCompareFunc returns the maximum value of the given values or optval.None if values is empty. It uses provided compare function for comparison.
func MaxByLess ¶
func MaxByLess[V constraints.OrderedByLess[V]](values iter.Seq[V]) optval.Value[V]
MaxByLess returns the maximum value of the given values or optval.None if values is empty. It uses Less method for comparison.
func MaxByLessFunc ¶
MaxByLessFunc returns the maximum value of the given values or optval.None if values is empty. It uses provided less function for comparison.
func Min ¶
Min returns the minimum value of the given values or optval.None if values is empty.
func MinBy ¶
MinBy returns the minimum value of the given values or optval.None value if values is empty. It uses provided key function for comparison.
func MinByCompare ¶
func MinByCompare[V constraints.OrderedByCompare[V]](values iter.Seq[V]) optval.Value[V]
MinByCompare returns the minimum value of the given values or optval.None value if values is empty. It uses Compare method for comparison.
func MinByCompareFunc ¶
MinByCompareFunc returns the minimum value of the given values or optval.None value if values is empty. It uses provided compare function for comparison.
func MinByLess ¶
func MinByLess[V constraints.OrderedByLess[V]](values iter.Seq[V]) optval.Value[V]
MinByLess returns the minimum value of the given values or optval.None value if values is empty. It uses Less method for comparison.
func MinByLessFunc ¶
MinByLessFunc returns the minimum value of the given values or optval.None value if values is empty. It uses provided less function for comparison.
func Reduce ¶
Reduce reduces the values to a value which is the accumulated result of running accumulate function on each element where each successive invocation is supplied the return value of the previous one.
Reduce returns optval.None if the sequence is empty.
func ReduceWith ¶
ReduceWith returns a function that reduces the values to a value which is the accumulated result of running accumulate function on each element where each successive invocation is supplied the return value of the previous one.
Types ¶
This section is empty.