Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
func Add[V ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~string | ~float32 | ~float64](a, b V) V
Add returns the sum of `a` and `b`.
Example ¶
package main
import (
"fmt"
"slices"
"github.com/BooleanCat/go-functional/v2/it"
"github.com/BooleanCat/go-functional/v2/it/op"
)
func main() {
fmt.Println(it.Reduce(slices.Values([]int{1, 2, 3}), op.Add, 0))
}
Output: 6
Example (String) ¶
package main
import (
"fmt"
"slices"
"github.com/BooleanCat/go-functional/v2/it"
"github.com/BooleanCat/go-functional/v2/it/op"
)
func main() {
fmt.Println(it.Reduce(slices.Values([]string{"a", "b", "c"}), op.Add, ""))
}
Output: abc
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.