go-seqs

module
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT-0

README

go-seqs

go-seqs is a library for working with sequence-like data in Go, taking advantage of generics introduced in Go 1.18.

Usage

Add the library as a dependency:

go get github.com/siliconbrain/go-seqs

Import it into your code:

import "github.com/siliconbrain/go-seqs/seqs"

Use to your heart's delight!

Comparision with iter

The iter package defines Seq as

type Seq[V any] func(yield func(V) bool)

which unfortunately means no non-trivial methods can be defined on implementations. Meanwhile, implementations of our seqs.Seq interface can also implement any other interface, e.g. optional length queries via seqs.Lener/seqs.FiniteSeq.

Unfortunately, seqs.Seq is not directly compatible with iter.Seq since yield's return value's meaning is inverted.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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