seq

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chunk added in v0.3.0

func Chunk[T any](s iter.Seq[T], n int) iter.Seq[iter.Seq[T]]

Chunk returns an iterator over consecutive elements of up to n elements of s.

func ChunkPairs added in v0.6.0

func ChunkPairs[T any](input iter.Seq[T]) iter.Seq2[T, T]

ChunkPairs returns an iterator iter.Seq2[T, T] that generates consecutive pairs (T, T) from the input iterator iter.Seq[T]. If the input sequence has an odd number of elements, the last element is ignored.

func Drop

func Drop[T any](s iter.Seq[T], n int) iter.Seq[T]

Drop returns new iter.Seq that yields all elements from the argument except first n ones.

If n < 0, iter.Seq that yields all elements from the argument.

func DropWhile

func DropWhile[T any](s iter.Seq[T], predicate func(T) bool) iter.Seq[T]

DropWhile returns new iter.Seq that yields the elements but dropped longest prefix satisfy the predicate from the argument.

func Take

func Take[T any](s iter.Seq[T], n int) iter.Seq[T]

Take returns new iter.Seq that yields first n elements from the argument.

func TakeWhile

func TakeWhile[T any](s iter.Seq[T], predicate func(T) bool) iter.Seq[T]

TakeWhile return new iter.Seq that yields longest prefix of elements from the argument.

func UnnestOnce added in v0.4.0

func UnnestOnce[T any](nested iter.Seq[iter.Seq[T]]) iter.Seq[T]

UnnestOnce flattens a sequence of sequences into a single sequence.

func Zip added in v0.2.0

func Zip[A, B any](as iter.Seq[A], bs iter.Seq[B]) iter.Seq2[A, B]

Zip returns new iter.Seq2 yields elements that by combining corresponding elements in pairs from each sequences.

func ZipAll added in v0.2.0

func ZipAll[A, B any](as iter.Seq[A], bs iter.Seq[B], fillA A, fillB B) iter.Seq2[A, B]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL