seq

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: MIT Imports: 0 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForEach

func ForEach[T any](seq Seq[T], f func(T) error) error

ForEach applies clojure on iterator

Types

type Seq

type Seq[T any] interface {
	Value() T
	Next() bool
}

Generic Sequence

seq := createSeq()
for has := seq != nil; has; has = seq.Next() {
	seq.Value()
}

func DropWhile

func DropWhile[T any](seq Seq[T], f func(T) bool) Seq[T]

Drop values from iterator while predicate function true

func Filter

func Filter[T any](seq Seq[T], f func(T) bool) Seq[T]

Filter values from iterator

func From

func From[T any](xs T) Seq[T]

Lift instance of T into Seq[T] trait

func FromSlice added in v0.3.0

func FromSlice[T any](xs []T) Seq[T]

List instance of []T into Seq[T] trait

func Join

func Join[A, B any](lhs Seq[A], rhs func(A) Seq[B]) Seq[B]

Left join

func Map

func Map[A, B any](seq Seq[A], f func(A) B) Seq[B]

Map transform iterator type

func Plus

func Plus[T any](lhs, rhs Seq[T]) Seq[T]

Plus operation for iterators add one after another

func TakeWhile

func TakeWhile[T any](seq Seq[T], f func(T) bool) Seq[T]

Take values from iterator while predicate function true

Jump to

Keyboard shortcuts

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