iterators

package
v0.0.0-...-7d7b408 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All[T any](seq iter.Seq[T], fn func(T) bool) bool

All returns true if fn returns true for all of the items contained in the slice.

func AllSlice

func AllSlice[T any](slice []T, fn func(T) bool) bool

All returns true if fn returns true for all of the items contained in the slice.

func Any

func Any[T any](seq iter.Seq[T], fn func(T) bool) bool

Any returns true if fn returns true for any of the items produced by the iterator.

func AnySlice

func AnySlice[T any](slice []T, fn func(T) bool) bool

Any returns true if fn returns true for any of the items contained in the slice.

func Filter

func Filter[T1 any](items iter.Seq[T1], f func(T1) bool) iter.Seq[T1]

Filter returns an iteartor that outputs each item from the given sequence that satisfy the condition "f(item) == true".

func FilterSlice

func FilterSlice[T1 any](items []T1, f func(T1) bool) []T1

Filter returns a slice that contains all items from the given slice that satisfy the condition "f(item) == true".

func Map

func Map[T1, T2 any](items iter.Seq[T1], f func(T1) T2) iter.Seq[T2]

Map returns an iterator that outputs the result of the function f applied to each item of the given Sequence.

func MapSlice

func MapSlice[T1, T2 any](items []T1, f func(T1) T2) []T2

Map returns a slice of which each items contains the result of the function f applied to each item from the provided slice.

func MustLines

func MustLines(r io.Reader) iter.Seq[string]

MustLines returns an iteator over the lines read from the io.Reader. This version returns strings.

func MustLinesBytes

func MustLinesBytes(r io.Reader) iter.Seq[[]byte]

MustLines returns an iteator over the lines read from the io.Reader. This version returns slices of bytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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