Documentation
¶
Overview ¶
Package tuple provides definition of generic n-ary tuples, from T2 to T10.
Quick Start ¶
package main
import (
"fmt"
"github.com/bytedance/gg/collection/tuple"
)
func main() {
addr := tuple.Make2("localhost", 8080)
fmt.Printf("%s:%d\n", addr.First, addr.Second)
// Output:
// localhost:8080
}
If you have a need for n-ary (where n > 10) tuple, please file an issue.
Example ¶
addr := Make2("localhost", 8080)
fmt.Printf("%s:%d\n", addr.First, addr.Second) // localhost:8080
s := Zip2([]string{"red", "green", "blue"}, []int{14, 15, 16})
for _, v := range s {
fmt.Printf("%s:%d\n", v.First, v.Second)
}
fmt.Println(s.Unzip()) // ["red", "green", "blue"] [14, 15, 16]
Output: localhost:8080 red:14 green:15 blue:16 [red green blue] [14 15 16]
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type S10 ¶
type S10[V1, V2, V3, V4, V5, V6, V7, V8, V9, V10 any] []T10[V1, V2, V3, V4, V5, V6, V7, V8, V9, V10]
S10 is a slice of 10-ary tuple.
type T2 ¶
type T2[V1, V2 any] struct { First V1 Second V2 }
T2 is a 2-ary tuple.
type T3 ¶
type T3[V1, V2, V3 any] struct { First V1 Second V2 Third V3 }
T3 is a 3-ary tuple.
type T4 ¶
type T4[V1, V2, V3, V4 any] struct { First V1 Second V2 Third V3 Fourth V4 }
T4 is a 4-ary tuple.
type T5 ¶
type T5[V1, V2, V3, V4, V5 any] struct { First V1 Second V2 Third V3 Fourth V4 Fifth V5 }
T5 is a 5-ary tuple.
type T6 ¶
type T6[V1, V2, V3, V4, V5, V6 any] struct { First V1 Second V2 Third V3 Fourth V4 Fifth V5 Sixth V6 }
T6 is a 6-ary tuple.
type T7 ¶
type T7[V1, V2, V3, V4, V5, V6, V7 any] struct { First V1 Second V2 Third V3 Fourth V4 Fifth V5 Sixth V6 Seventh V7 }
T7 is a 7-ary tuple.
type T8 ¶
type T8[V1, V2, V3, V4, V5, V6, V7, V8 any] struct { First V1 Second V2 Third V3 Fourth V4 Fifth V5 Sixth V6 Seventh V7 Eighth V8 }
T8 is a 8-ary tuple.
type T9 ¶
type T9[V1, V2, V3, V4, V5, V6, V7, V8, V9 any] struct { First V1 Second V2 Third V3 Fourth V4 Fifth V5 Sixth V6 Seventh V7 Eighth V8 Ninth V9 }
T9 is a 9-ary tuple.
type T10 ¶
type T10[V1, V2, V3, V4, V5, V6, V7, V8, V9, V10 any] struct { First V1 Second V2 Third V3 Fourth V4 Fifth V5 Sixth V6 Seventh V7 Eighth V8 Ninth V9 Tenth V10 }
T10 is a 10-ary tuple.
Click to show internal directories.
Click to hide internal directories.