N-tuple structures for Go with generics
- Couple
- Pair
- Dyad
- Triple
- Triplet
- Triad
- Quadruple
- Quartet
- Quad
- Tetrad
- Quintuple
- Quint
- Pentuple
- Pentad
- Sextuple
- Hextuple
- Hexad
- Septuple
- Heptuple
- Heptad
- Octuple
- Octet
- Octad
- Nonuple
- Nonad
- Decuple
- Decad
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)
}
This library is generated by internal/gen/main.go
.
Use this command:
$ go generate ./...