vector

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package vector provides ordered immutable.Vector constructors and helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Conv

func Conv[From, To comparable](vector immutable.Vector[From], converter func(From) (To, error)) breakLoop.Loop[To]

Conv returns a breakable loop that applies the 'converter' function to the collection elements

func Convert

func Convert[From, To any](vector immutable.Vector[From], converter func(From) To) loop.Loop[To]

Convert returns a loop that applies the 'converter' function to the collection elements

func Flat

func Flat[From any, To any](vector immutable.Vector[From], flattener func(From) []To) loop.Loop[To]

Flat returns a loop that converts the collection elements into slices and then flattens them to one level

func Flatt

func Flatt[From, To comparable](vector immutable.Vector[From], flattener func(From) ([]To, error)) breakLoop.Loop[To]

Flatt returns a breakable loop that converts the collection elements into slices and then flattens them to one level

func From

func From[T any](next func() (T, bool)) immutable.Vector[T]

From instantiates a vector with elements retrieved by the 'next' function. The next returns an element with true or zero value with false if there are no more elements.

func New

func New[T any](elements []T) immutable.Vector[T]

New instantiates a vector with the specified elements

func Of

func Of[T any](elements ...T) immutable.Vector[T]

Of instantiates a vector with the specified elements

func Sort

func Sort[T any, F constraints.Ordered](v immutable.Vector[T], by func(T) F) immutable.Vector[T]

Sort copy the specified vector with sorted elements

func Wrap added in v0.0.11

func Wrap[T any](elements []T) immutable.Vector[T]

Wrap instantiates Vector using a slise as internal storage.

Types

This section is empty.

Jump to

Keyboard shortcuts

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