sorted

package module
v0.0.0-...-cd76687 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

README

sorted

A package for sorted iterators.

Documentation

Overview

Package sorted provides operations over iterators whose values are sorted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Intersect

func Intersect[T cmp.Ordered](s1, s2 iter.Seq[T]) iter.Seq[T]

Intersect returns an iterator over all elements of s1 that are also in s2, in the same order. Each element of s1 appears only once in the result. Both s1 and s2 must be sorted.

func IntersectFunc

func IntersectFunc[T any](s1, s2 iter.Seq[T], cmp func(T, T) int) iter.Seq[T]

IntersectFunc returns an iterator over all elements of s1 that are also in s2, in the same order. Each element of s1 appears only once in the result. Both s1 and s2 must be sorted according to cmp.

func Merge

func Merge[T cmp.Ordered](s1, s2 iter.Seq[T]) iter.Seq[T]

Merge returns an iterator over all elements of s1 and s2, in the same order. Both s1 and s2 must be sorted.

func MergeFunc

func MergeFunc[T any](s1, s2 iter.Seq[T], cmp func(T, T) int) iter.Seq[T]

MergeFunc returns an iterator over all elements of s1 and s2, in the same order. Both s1 and s2 must be sorted according to cmp.

func Subtract

func Subtract[T cmp.Ordered](s1, s2 iter.Seq[T]) iter.Seq[T]

Subtract returns an iterator over all elements of s1 that are not in s2, in the same order. Each element of s1 appears only once in the result. Both s1 and s2 must be sorted.

func SubtractFunc

func SubtractFunc[T any](s1, s2 iter.Seq[T], cmp func(T, T) int) iter.Seq[T]

SubtractFunc returns an iterator over all elements of s1 that are not in s2, in the same order. Each element of s1 appears only once in the result. Both s1 and s2 must be sorted according to cmp.

func Union

func Union[T cmp.Ordered](s1, s2 iter.Seq[T]) iter.Seq[T]

Union returns an iterator over all elements of s1 and s2, in the same order. Each element appears only once in the result. Both s1 and s2 must be sorted.

func UnionFunc

func UnionFunc[T any](s1, s2 iter.Seq[T], cmp func(T, T) int) iter.Seq[T]

UnionFunc returns an iterator over all elements of s1 and s2, in the same order. Each element appears only once in the result. Both s1 and s2 must be sorted according to cmp.

Types

This section is empty.

Jump to

Keyboard shortcuts

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