tuple

module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2021 License: MIT

README

tuple

N-tuple structures for Go with generics

Types

2-tuple
  • Couple
  • Pair
  • Dyad
3-tuple
  • Triple
  • Triplet
  • Triad
4-tuple
  • Quadruple
  • Quartet
  • Quad
  • Tetrad
5-tuple
  • Quintuple
  • Quint
  • Pentuple
  • Pentad
6-tuple
  • Sextuple
  • Hextuple
  • Hexad
7-tuple
  • Septuple
  • Heptuple
  • Heptad
8-tuple
  • Octuple
  • Octet
  • Octad
9-tuple
  • Nonuple
  • Nonad
10-tuple
  • Decuple
  • Decad

Example

package main

import (
	"fmt"
	"os"

	"github.com/makiuchi-d/tuple"
)

func main() {
	buf := make([]byte, 100)
	ch := make(chan tuple.Pair[int, error])

	go func() {
		n, err := os.Stdin.Read(buf)
		ch <- tuple.NewPair(n, err)
	}()

	r := <-ch
	fmt.Println(buf[:r.V1], r.V2)
}

Code Generation

This library is generated by internal/gen/main.go. Use this command:

$ go generate ./...

Directories

Path Synopsis
internal
gen

Jump to

Keyboard shortcuts

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