iter

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendTo

func AppendTo[T any](vs []T, iter tl.Iter[T]) []T

func Filter

func Filter[T any](inner tl.Iter[T], fn tl.CompareFunc[T]) tl.Iter[T]

Filter filters the values of iterators.

func Flatten

func Flatten[T any](inner tl.Iter[[]T]) tl.Iter[T]

Flatten flattens the elements of `inner`.

func Get

func Get[T any](iter tl.Iter[T]) T

Get returns the last element of the iterator.

func Index

func Index[T any](iter tl.Iter[T], cmpFn tl.CompareFunc[T]) int

Index indexes an element inside an iterator.

func Map

func Map[T, V any](inner tl.Iter[T], conv func(T) V) tl.Iter[V]

Map maps the values of an iterator using `conv`.

func Nth

func Nth[T any](inner tl.Iter[T], nth int) tl.Iter[T]

Nth takes the nth element of an iterator.

func Range

func Range[T constraints.Integer](start, stop, step T) tl.Iter[T]

Range creates an iterator over a range.

func Search[T any](iter tl.Iter[T], cmpFn tl.CompareFunc[T]) tl.Iter[T]

Search searches for an element inside an iterator.

func Slice

func Slice[T any](vs []T) tl.Iter[T]

func Sum

func Sum[T constraints.Integer | constraints.Float](inner tl.Iter[T]) tl.Iter[T]

Sum sums up all the elements inside an iterator.

func ToSlice

func ToSlice[T any](iter tl.Iter[T]) []T

ToSlice converts a iterator to a slice.

func Unique

func Unique[T comparable](inner tl.Iter[T]) tl.Iter[T]

Unique removes any duplicates from the iterator.

func UniqueFn

func UniqueFn[T any](inner tl.Iter[T], eq func(a, b T) bool) tl.Iter[T]

UniqueFn removes any duplicates from the iterator using `eq` as comparator.

func Window

func Window[T any](inner tl.Iter[T], n int) tl.Iter[[]T]

Window returns an iterator containing the last `n` values.

func WindowCopy

func WindowCopy[T any](inner tl.Iter[T], n int) tl.Iter[[]T]

WindowCopy operates like Window but copying the values.

func WindowSlice

func WindowSlice[T any](vs []T, n int) tl.Iter[[]T]

Types

This section is empty.

Jump to

Keyboard shortcuts

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