Documentation
¶
Index ¶
- func All[T ~map[E]struct{}, E comparable](s T, pred func(v E) bool) bool
- func Any[T ~map[E]struct{}, E comparable](s T, pred func(v E) bool) bool
- func Collect[T comparable](it iter.Seq[T]) fx.Set[T]
- func FMap[T ~map[E]struct{}, E comparable, U any](s T, fn func(v E) (U, bool)) iter.Seq[U]
- func Filter[T ~map[E]struct{}, E comparable](s T, fn func(v E) bool) iter.Seq[E]
- func Intersection[T ~map[E]struct{}, U ~map[E]struct{}, E comparable](s1 T, s2 U) fx.Set[E]
- func Map[T ~map[E]struct{}, E comparable, U any](s T, fn func(v E) U) iter.Seq[U]
- func OfType[T ~map[E]struct{}, E comparable, U any](s T) iter.Seq[U]
- func Reduce[T ~map[E]struct{}, E comparable, U any](s T, init U, fn func(acc U, v E) U) U
- func Take[T ~map[E]struct{}, E comparable](s T, n int) iter.Seq[E]
- func TryCollect[T comparable](it iter.Seq2[T, error]) (fx.Set[T], error)
- func Union[T ~map[E]struct{}, U ~map[E]struct{}, E comparable](s1 T, s2 U) fx.Set[E]
- func Values[T ~map[E]struct{}, E comparable](s T) iter.Seq[E]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All[T ~map[E]struct{}, E comparable](s T, pred func(v E) bool) bool
All returns true if pred returns true for every element of the input set.
func Any ¶
func Any[T ~map[E]struct{}, E comparable](s T, pred func(v E) bool) bool
Any returns true if pred returns true for any element of the input set.
func Collect ¶
func Collect[T comparable](it iter.Seq[T]) fx.Set[T]
Collect collects the values in the input sequence into a set.
func FMap ¶
func FMap[T ~map[E]struct{}, E comparable, U any](s T, fn func(v E) (U, bool)) iter.Seq[U]
FMap returns a sequence of values computed by invoking fn on each element of the input set and returning only mapped values for with fn returns true.
func Filter ¶
func Filter[T ~map[E]struct{}, E comparable](s T, fn func(v E) bool) iter.Seq[E]
Filter returns a sequence of values computed by invoking fn on each element of the input set and returning only those elements for with fn returns true.
func Intersection ¶
func Intersection[T ~map[E]struct{}, U ~map[E]struct{}, E comparable](s1 T, s2 U) fx.Set[E]
Intersection returns a new set that is the intersection of the input sets.
func Map ¶
func Map[T ~map[E]struct{}, E comparable, U any](s T, fn func(v E) U) iter.Seq[U]
Map invokes fn on each value in the input set and returns the results.
func OfType ¶
func OfType[T ~map[E]struct{}, E comparable, U any](s T) iter.Seq[U]
OfType returns a sequence composed of all elements in the input set that are of type U.
func Reduce ¶
func Reduce[T ~map[E]struct{}, E comparable, U any](s T, init U, fn func(acc U, v E) U) U
Reduce calls fn on each element of the input set, passing in the current value of the accumulator with each invocation and updating the accumulator to the result of fn after each invocation.
func Take ¶
func Take[T ~map[E]struct{}, E comparable](s T, n int) iter.Seq[E]
Take returns an iterator that takes at most n values from the input set.
func TryCollect ¶
func TryCollect[T comparable](it iter.Seq2[T, error]) (fx.Set[T], error)
TryCollect attempts to collect the values in the input sequence into a set. If any pair in the input contains a non-nil error, TryCollect halts and returns the values collected up to that point (excluding the value returned with the error) and the error.
func Union ¶
func Union[T ~map[E]struct{}, U ~map[E]struct{}, E comparable](s1 T, s2 U) fx.Set[E]
Union returns a new set that is the union of the input sets.
func Values ¶
func Values[T ~map[E]struct{}, E comparable](s T) iter.Seq[E]
Values returns a sequence of each value in the input set. The ordering of elements is undefined.
Types ¶
This section is empty.