Documentation
¶
Index ¶
- func All[T any](it iter.Seq[T], pred func(v T) bool) bool
- func And[T any](preds ...func(v T) bool) func(T) bool
- func Any[T any](it iter.Seq[T], pred func(v T) bool) bool
- func Concat[T any](iters ...iter.Seq[T]) iter.Seq[T]
- func ConcatMany[T any](iters iter.Seq[iter.Seq[T]]) iter.Seq[T]
- func Empty[T any]() iter.Seq[T]
- func FMap[T, U any](it iter.Seq[T], fn func(v T) (U, bool)) iter.Seq[U]
- func Filter[T any](it iter.Seq[T], fn func(v T) bool) iter.Seq[T]
- func Map[T, U any](it iter.Seq[T], fn func(v T) U) iter.Seq[U]
- func MinRange(min int) iter.Seq[int]
- func Not[T any](pred func(v T) bool) func(T) bool
- func OfType[T, U any](it iter.Seq[T]) iter.Seq[U]
- func Only[T any](v T) iter.Seq[T]
- func Or[T any](preds ...func(v T) bool) func(T) bool
- func PackAll[K, V any](it iter.Seq2[K, V]) iter.Seq[Pair[K, V]]
- func Range(min, max int) iter.Seq[int]
- func Reduce[T, U any](it iter.Seq[T], init U, fn func(acc U, v T) U) U
- func Take[T any](it iter.Seq[T], n int) iter.Seq[T]
- func TryFunc[T, U any](fn func(t T) (U, error)) func(t T) Result[U]
- func UnpackAll[K, V any](it iter.Seq[Pair[K, V]]) iter.Seq2[K, V]
- type Pair
- type Result
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func And ¶
And combines a list of predicates into a predicate that returns true if every predicate in the list returns true.
func ConcatMany ¶
ConcatMany returns an iterator that returns values from each iterator in sequence.
func FMap ¶
FMap returns a sequence of values computed by invoking fn on each element of the input sequence and returning only mapped values for with fn returns true.
func Filter ¶
Filter returns a sequence of values computed by invoking fn on each element of the input sequence and returning only those elements for with fn returns true.
func OfType ¶
OfType returns a sequence composed of all elements in the input sequence that are of type U.
func Or ¶
Or combines a list of predicates into a predicate that returns true if any predicate in the list returns true.
func Reduce ¶
Reduce calls fn on each element of the input sequence, passing in the current value of the accumulator with each invocation and updating the accumulator to the result of fn after each invocation.
Types ¶
type Pair ¶
type Pair[T, U any] struct { Fst T Snd U }
A Pair is a pair of (possibly-differently) typed values.
type Result ¶
type Result[T any] struct { // contains filtered or unexported fields }
A Result wraps a (T, error) tuple in a single value.
type Set ¶
type Set[T comparable] map[T]struct{}
A Set represents a set of comparable values.
func (Set[T]) ToSlice ¶
func (s Set[T]) ToSlice() []T
ToSlice returns a slice that contains the values in the set. The ordering of elements is undefined.