pair

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package pair provides tuple types and functions for working with pairs of values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ZipWith added in v0.6.0

func ZipWith[A, B, R any](as []A, bs []B, fn func(A, B) R) []R

ZipWith applies fn to corresponding elements of the two input slices. Panics if the slices have different lengths.

Types

type X

type X[V1, V2 any] struct {
	V1 V1
	V2 V2
}

X is a value of the Cartesian cross-product of the given types. Cross-product is represented by an x.

func Of

func Of[V, V2 any](v V, v2 V2) X[V, V2]

func Zip

func Zip[V1, V2 any](v1s []V1, v2s []V2) []X[V1, V2]

Zip returns a slice of each pair of elements from the two input slices. Panics if the slices have different lengths.

Jump to

Keyboard shortcuts

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