Beispiel #1
0
func ExampleSum() {
	in := []int{1, 2, 3, 4}
	out := generic.Sum(in).(int)
	fmt.Println(out)
	// Output: 10
}
Beispiel #2
0
func ExampleSum_slice() {
	in := [][]int{[]int{1, 2}, []int{3, 4}}
	out := generic.Sum(in).([]int)
	fmt.Println(out)
	// Output: [1 2 3 4]
}