Documentation
¶
Index ¶
- func Accumulate[A, Value any](seq iter.Seq[Value], acc func(Value, A) A) A
- func ChanAsSeq[Value any](ch <-chan Value) iter.Seq[Value]
- func Filter[Value any](seq iter.Seq[Value], f func(Value) bool) iter.Seq[Value]
- func Generate[Value any](generator func() Value) iter.Seq[Value]
- func Generator[Value, Context any](c Context, f func(Context) Value) func() Value
- func Index[I ~int | ~uint](i I) func() I
- func Last[Value any](seq iter.Seq[Value]) (result Value)
- func Map[ValueIn, ValueOut any](seq iter.Seq[ValueIn], f func(ValueIn) ValueOut) iter.Seq[ValueOut]
- func Map15[K, V, Value any](seq iter.Seq2[K, V], f func(K, V) Value) iter.Seq[Value]
- func Map2[KeyIn, ValueIn, KeyOut, ValueOut any](seq iter.Seq2[KeyIn, ValueIn], f func(KeyIn, ValueIn) (KeyOut, ValueOut)) iter.Seq2[KeyOut, ValueOut]
- func Range(begin, end, step int) iter.Seq[int]
- func SeqAsChan[Value any](seq iter.Seq[Value]) <-chan Value
- func Tail[Value any](seq iter.Seq[Value]) (Value, bool, iter.Seq[Value])
- func Take[Value any](n uint, seq iter.Seq[Value]) iter.Seq[Value]
- func Until[Value any](seq iter.Seq[Value], f func(Value) bool) iter.Seq[Value]
- func Zip[A, B any](a iter.Seq[A], b iter.Seq[B]) iter.Seq2[A, B]
- func ZipShort[A, B any](a iter.Seq[A], b iter.Seq[B]) iter.Seq2[A, B]
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Accumulate ¶
Accumulate passes sequence values through the accumulator function and returns the accumulated value.
func Generator ¶
func Generator[Value, Context any](c Context, f func(Context) Value) func() Value
Generator makes a generator providing context to the given function.
func Index ¶
Index returns a sequence index generator function.
Example ¶
package main
import (
"fmt"
"slices"
"github.com/parametalol/curry/seq"
)
func main() {
fmt.Println(slices.Collect(
seq.Take(5,
seq.Generate(seq.Index(5)))))
}
Output: [5 6 7 8 9]
func Map15 ¶
Map15 translates key-value sequence to a single value sequence with the provided function.
func Map2 ¶
func Map2[KeyIn, ValueIn, KeyOut, ValueOut any](seq iter.Seq2[KeyIn, ValueIn], f func(KeyIn, ValueIn) (KeyOut, ValueOut)) iter.Seq2[KeyOut, ValueOut]
Map2 translates one key-value sequence to another with the provided function.
func Range ¶
Range generates a sequnce of integer between the given begin and end, with given the step.
func Tail ¶
Tail reads the first value from the sequence, returns whether it managed to get it, and the iterator to the rest of the sequence.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.