package generic
import "github.com/IBM/fp-go/iterator/stateless/generic"
Index ¶
- func Any[GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(U) bool, U any](pred FCT) func(ma GU) bool
- func Ap[GUV ~func() O.Option[P.Pair[GUV, func(U) V]], GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](ma GU) func(fab GUV) GV
- func ApS[GAS2 ~func() O.Option[P.Pair[GAS2, func(A) S2]], GS1 ~func() O.Option[P.Pair[GS1, S1]], GS2 ~func() O.Option[P.Pair[GS2, S2]], GA ~func() O.Option[P.Pair[GA, A]], S1, S2, A any]( setter func(A) func(S1) S2, fa GA, ) func(GS1) GS2
- func Bind[GS1 ~func() O.Option[P.Pair[GS1, S1]], GS2 ~func() O.Option[P.Pair[GS2, S2]], GA ~func() O.Option[P.Pair[GA, A]], S1, S2, A any]( setter func(A) func(S1) S2, f func(S1) GA, ) func(GS1) GS2
- func BindTo[GS1 ~func() O.Option[P.Pair[GS1, S1]], GA ~func() O.Option[P.Pair[GA, A]], S1, A any]( setter func(A) S1, ) func(GA) GS1
- func Chain[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](f func(U) GV) func(GU) GV
- func ChainFirst[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](f func(U) GV) func(GU) GU
- func Compress[GU ~func() O.Option[P.Pair[GU, U]], GB ~func() O.Option[P.Pair[GB, bool]], CS ~func() O.Option[P.Pair[CS, P.Pair[U, bool]]], U any](sel GB) func(GU) GU
- func Count[GU ~func() O.Option[P.Pair[GU, int]]](start int) GU
- func Current[GU ~func() O.Option[P.Pair[GU, U]], U any](m P.Pair[GU, U]) U
- func Cycle[GU ~func() O.Option[P.Pair[GU, U]], U any](ma GU) GU
- func Do[GS ~func() O.Option[P.Pair[GS, S]], S any]( empty S, ) GS
- func DropWhile[GU ~func() O.Option[P.Pair[GU, U]], U any](pred func(U) bool) func(GU) GU
- func Empty[GU ~func() O.Option[P.Pair[GU, U]], U any]() GU
- func Filter[GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(U) bool, U any](f FCT) func(ma GU) GU
- func FilterChain[GVV ~func() O.Option[P.Pair[GVV, GV]], GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(U) O.Option[GV], U, V any](f FCT) func(ma GU) GV
- func FilterMap[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(U) O.Option[V], U, V any](f FCT) func(ma GU) GV
- func First[GU ~func() O.Option[P.Pair[GU, U]], U any](mu GU) O.Option[U]
- func Flatten[GV ~func() O.Option[P.Pair[GV, GU]], GU ~func() O.Option[P.Pair[GU, U]], U any](ma GV) GU
- func Fold[GU ~func() O.Option[P.Pair[GU, U]], U any](m M.Monoid[U]) func(ma GU) U
- func FoldMap[GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(U) V, U, V any](m M.Monoid[V]) func(FCT) func(ma GU) V
- func From[GU ~func() O.Option[P.Pair[GU, U]], U any](data ...U) GU
- func FromArray[GU ~func() O.Option[P.Pair[GU, U]], US ~[]U, U any](as US) GU
- func FromLazy[GU ~func() O.Option[P.Pair[GU, U]], LZ ~func() U, U any](l LZ) GU
- func FromReflect[GR ~func() O.Option[P.Pair[GR, R.Value]]](val R.Value) GR
- func Last[GU ~func() O.Option[P.Pair[GU, U]], U any](mu GU) O.Option[U]
- func Let[GS1 ~func() O.Option[P.Pair[GS1, S1]], GS2 ~func() O.Option[P.Pair[GS2, S2]], S1, S2, A any]( key func(A) func(S1) S2, f func(S1) A, ) func(GS1) GS2
- func LetTo[GS1 ~func() O.Option[P.Pair[GS1, S1]], GS2 ~func() O.Option[P.Pair[GS2, S2]], S1, S2, B any]( key func(B) func(S1) S2, b B, ) func(GS1) GS2
- func MakeBy[GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(int) U, U any](f FCT) GU
- func Map[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(U) V, U, V any](f FCT) func(ma GU) GV
- func Monad[A, B any, GA ~func() O.Option[P.Pair[GA, A]], GB ~func() O.Option[P.Pair[GB, B]], GAB ~func() O.Option[P.Pair[GAB, func(A) B]]]() monad.Monad[A, B, GA, GB, GAB]
- func MonadAp[GUV ~func() O.Option[P.Pair[GUV, func(U) V]], GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](fab GUV, ma GU) GV
- func MonadChain[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](ma GU, f func(U) GV) GV
- func MonadChainFirst[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](ma GU, f func(U) GV) GU
- func MonadMap[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](ma GU, f func(U) V) GV
- func Monoid[GU ~func() O.Option[P.Pair[GU, U]], U any]() M.Monoid[GU]
- func Next[GU ~func() O.Option[P.Pair[GU, U]], U any](m P.Pair[GU, U]) GU
- func Of[GU ~func() O.Option[P.Pair[GU, U]], U any](a U) GU
- func Reduce[GU ~func() O.Option[P.Pair[GU, U]], U, V any](f func(V, U) V, initial V) func(GU) V
- func Repeat[GU ~func() O.Option[P.Pair[GU, U]], U any](n int, a U) GU
- func Replicate[GU ~func() O.Option[P.Pair[GU, U]], U any](a U) GU
- func Scan[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(V, U) V, U, V any](f FCT, initial V) func(ma GU) GV
- func StrictUniq[AS ~func() O.Option[P.Pair[AS, A]], A comparable](as AS) AS
- func Take[GU ~func() O.Option[P.Pair[GU, U]], U any](n int) func(ma GU) GU
- func ToArray[GU ~func() O.Option[P.Pair[GU, U]], US ~[]U, U any](u GU) US
- func Uniq[AS ~func() O.Option[P.Pair[AS, A]], K comparable, A any](f func(A) K) func(as AS) AS
- func Zip[AS ~func() O.Option[P.Pair[AS, A]], BS ~func() O.Option[P.Pair[BS, B]], CS ~func() O.Option[P.Pair[CS, P.Pair[A, B]]], A, B any](fb BS) func(AS) CS
- func ZipWith[AS ~func() O.Option[P.Pair[AS, A]], BS ~func() O.Option[P.Pair[BS, B]], CS ~func() O.Option[P.Pair[CS, C]], FCT ~func(A, B) C, A, B, C any](fa AS, fb BS, f FCT) CS
Functions ¶
func Any ¶
Any returns `true` if any element of the iterable is `true`. If the iterable is empty, return `false`
func Ap ¶
func Ap[GUV ~func() O.Option[P.Pair[GUV, func(U) V]], GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](ma GU) func(fab GUV) GV
func ApS ¶
func ApS[GAS2 ~func() O.Option[P.Pair[GAS2, func(A) S2]], GS1 ~func() O.Option[P.Pair[GS1, S1]], GS2 ~func() O.Option[P.Pair[GS2, S2]], GA ~func() O.Option[P.Pair[GA, A]], S1, S2, A any]( setter func(A) func(S1) S2, fa GA, ) func(GS1) GS2
ApS attaches a value to a context [S1] to produce a context [S2] by considering the context and the value concurrently
func Bind ¶
func Bind[GS1 ~func() O.Option[P.Pair[GS1, S1]], GS2 ~func() O.Option[P.Pair[GS2, S2]], GA ~func() O.Option[P.Pair[GA, A]], S1, S2, A any]( setter func(A) func(S1) S2, f func(S1) GA, ) func(GS1) GS2
Bind attaches the result of a computation to a context [S1] to produce a context [S2]
func BindTo ¶
func BindTo[GS1 ~func() O.Option[P.Pair[GS1, S1]], GA ~func() O.Option[P.Pair[GA, A]], S1, A any]( setter func(A) S1, ) func(GA) GS1
BindTo initializes a new state [S1] from a value [T]
func Chain ¶
func Chain[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](f func(U) GV) func(GU) GV
func ChainFirst ¶
func ChainFirst[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](f func(U) GV) func(GU) GU
func Compress ¶
func Compress[GU ~func() O.Option[P.Pair[GU, U]], GB ~func() O.Option[P.Pair[GB, bool]], CS ~func() O.Option[P.Pair[CS, P.Pair[U, bool]]], U any](sel GB) func(GU) GU
Compress returns an [Iterator] that filters elements from a data [Iterator] returning only those that have a corresponding element in selector [Iterator] that evaluates to `true`. Stops when either the data or selectors iterator has been exhausted.
func Count ¶
Count creates an [Iterator] containing a consecutive sequence of integers starting with the provided start value
func Current ¶
Current returns the current element in an iterator `P.Pair`
func Cycle ¶
func Do ¶
Bind creates an empty context of type [S] to be used with the Bind operation
func DropWhile ¶
DropWhile creates an [Iterator] that drops elements from the [Iterator] as long as the predicate is true; afterwards, returns every element. Note, the [Iterator] does not produce any output until the predicate first becomes false
func Empty ¶
Empty returns the empty iterator
func Filter ¶
func FilterChain ¶
func FilterChain[GVV ~func() O.Option[P.Pair[GVV, GV]], GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(U) O.Option[GV], U, V any](f FCT) func(ma GU) GV
func FilterMap ¶
func FilterMap[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(U) O.Option[V], U, V any](f FCT) func(ma GU) GV
func First ¶
First returns the first item in an iterator if such an item exists
func Flatten ¶
func Flatten[GV ~func() O.Option[P.Pair[GV, GU]], GU ~func() O.Option[P.Pair[GU, U]], U any](ma GV) GU
func Fold ¶
func FoldMap ¶
func FoldMap[GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(U) V, U, V any](m M.Monoid[V]) func(FCT) func(ma GU) V
func From ¶
From constructs an array from a set of variadic arguments
func FromArray ¶
FromArray returns an iterator from multiple elements
func FromLazy ¶
FromLazy returns an iterator on top of a lazy function
func FromReflect ¶
func Last ¶
Last returns the last item in an iterator if such an item exists
func Let ¶
func Let[GS1 ~func() O.Option[P.Pair[GS1, S1]], GS2 ~func() O.Option[P.Pair[GS2, S2]], S1, S2, A any]( key func(A) func(S1) S2, f func(S1) A, ) func(GS1) GS2
Let attaches the result of a computation to a context [S1] to produce a context [S2]
func LetTo ¶
func LetTo[GS1 ~func() O.Option[P.Pair[GS1, S1]], GS2 ~func() O.Option[P.Pair[GS2, S2]], S1, S2, B any]( key func(B) func(S1) S2, b B, ) func(GS1) GS2
LetTo attaches the a value to a context [S1] to produce a context [S2]
func MakeBy ¶
MakeBy returns an [Iterator] with an infinite number of elements initialized with `f(i)`
func Map ¶
func Map[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(U) V, U, V any](f FCT) func(ma GU) GV
func Monad ¶
func Monad[A, B any, GA ~func() O.Option[P.Pair[GA, A]], GB ~func() O.Option[P.Pair[GB, B]], GAB ~func() O.Option[P.Pair[GAB, func(A) B]]]() monad.Monad[A, B, GA, GB, GAB]
Monad implements the monadic operations for iterators
func MonadAp ¶
func MonadAp[GUV ~func() O.Option[P.Pair[GUV, func(U) V]], GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](fab GUV, ma GU) GV
func MonadChain ¶
func MonadChain[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](ma GU, f func(U) GV) GV
func MonadChainFirst ¶
func MonadChainFirst[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](ma GU, f func(U) GV) GU
func MonadMap ¶
func MonadMap[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], U, V any](ma GU, f func(U) V) GV
func Monoid ¶
func Next ¶
Next returns the iterator for the next element in an iterator `P.Pair`
func Of ¶
Of returns an iterator with one single element
func Reduce ¶
Reduce applies a function for each value of the iterator with a floating result
func Repeat ¶
Repeat creates an [Iterator] containing a value repeated the specified number of times. Alias of Replicate combined with Take
func Replicate ¶
Replicate creates an infinite [Iterator] containing a value.
func Scan ¶
func Scan[GV ~func() O.Option[P.Pair[GV, V]], GU ~func() O.Option[P.Pair[GU, U]], FCT ~func(V, U) V, U, V any](f FCT, initial V) func(ma GU) GV
func StrictUniq ¶
func StrictUniq[AS ~func() O.Option[P.Pair[AS, A]], A comparable](as AS) AS
func Take ¶
func ToArray ¶
ToArray converts the iterator to an array
func Uniq ¶
func Zip ¶
func Zip[AS ~func() O.Option[P.Pair[AS, A]], BS ~func() O.Option[P.Pair[BS, B]], CS ~func() O.Option[P.Pair[CS, P.Pair[A, B]]], A, B any](fb BS) func(AS) CS
Zip takes two iterators and returns an iterators of corresponding pairs. If one input iterators is short, excess elements of the longer iterator are discarded
func ZipWith ¶
func ZipWith[AS ~func() O.Option[P.Pair[AS, A]], BS ~func() O.Option[P.Pair[BS, B]], CS ~func() O.Option[P.Pair[CS, C]], FCT ~func(A, B) C, A, B, C any](fa AS, fb BS, f FCT) CS
ZipWith applies a function to pairs of elements at the same index in two iterators, collecting the results in a new iterator. If one input iterator is short, excess elements of the longer iterator are discarded.
Source Files ¶
any.go bind.go compress.go cycle.go dropwhile.go first.go io.go iterator.go last.go monad.go monoid.go reflect.go scan.go take.go uniq.go zip.go
- Version
- v1.0.151 (latest)
- Published
- Nov 23, 2024
- Platform
- linux/amd64
- Imports
- 17 packages
- Last checked
- 4 months ago –
Tools for package owners.