stat/combin: fix spelling
MODIFY
stat/combin/combin.go
stat/combin/combin.go
@@ -271,7 +271,7 @@ func IndexToCombination(dst []int, idx, n, k int) []int {
return dst
}
-// Cartesian returns the cartesian product of the slices in data. The Cartesian
+// Cartesian returns the Cartesian product of the slices in data. The Cartesian
// product of two sets is the set of all combinations of the items. For example,
// given the input
// []int{2, 3, 1}
@@ -311,7 +311,7 @@ func Card(dims []int) int {
return card
}
-// NewCartesianGenerator returns a CartesianGenerator for iterating over cartesian products which are generated on the fly.
+// NewCartesianGenerator returns a CartesianGenerator for iterating over Cartesian products which are generated on the fly.
// All values in lens must be positive, otherwise this will panic.
func NewCartesianGenerator(lens []int) *CartesianGenerator {
return &CartesianGenerator{
@@ -321,15 +321,15 @@ func NewCartesianGenerator(lens []int) *CartesianGenerator {
}
}
-// CartesianGenerator iterates over a cartesian product set.
+// CartesianGenerator iterates over a Cartesian product set.
type CartesianGenerator struct {
lens []int
rows int
idx int
}
-// Next moves to the next product of the cartesian set.
-// It returns false if the generator reached the end of the cartesian set end.
+// Next moves to the next product of the Cartesian set.
+// It returns false if the generator reached the end of the Cartesian set end.
func (g *CartesianGenerator) Next() bool {
if g.idx+1 < g.rows {
g.idx++
@@ -339,7 +339,7 @@ func (g *CartesianGenerator) Next() bool {
return false
}
-// Product generates one product of the cartesian set according to the current index which is increased by Next().
+// Product generates one product of the Cartesian set according to the current index which is increased by Next().
// Next needs to be called at least one time before this method, otherwise it will panic.
func (g *CartesianGenerator) Product(dst []int) []int {
return SubFor(dst, g.idx, g.lens)

MODIFY
stat/combin/combin_test.go
stat/combin/combin_test.go
@@ -294,7 +294,7 @@ func TestCartesian(t *testing.T) {
}
got := Cartesian(lens)
if !intSosMatch(want, got) {
- t.Errorf("cartesian data mismatch.\nwant:\n%v\ngot:\n%v", want, got)
+ t.Errorf("Cartesian data mismatch.\nwant:\n%v\ngot:\n%v", want, got)
}
}
@@ -302,7 +302,7 @@ func TestNumCartesianProducts(t *testing.T) {
want := 6
got := Card([]int{1, 2, 3})
if want != got {
- t.Errorf("number of cartesian products mismatch.\nwant:\n%v\ngot:\n%v", want, got)
+ t.Errorf("number of Cartesian products mismatch.\nwant:\n%v\ngot:\n%v", want, got)
}
}

MODIFY
stat/combin/combinations_example_test.go
stat/combin/combinations_example_test.go
@@ -11,7 +11,7 @@ import (
)
func ExampleCartesian() {
- fmt.Println("Generate cartesian products for given lengths:")
+ fmt.Println("Generate Cartesian products for given lengths:")
lens := []int{1, 2, 3}
list := combin.Cartesian(lens)
for i, v := range list {
@@ -22,7 +22,7 @@ func ExampleCartesian() {
// For big data sets, consider using CartesianGenerator instead.
// Output:
- // Generate cartesian products for given lengths:
+ // Generate Cartesian products for given lengths:
// 0 [0 0 0]
// 1 [0 0 1]
// 2 [0 0 2]
@@ -155,7 +155,7 @@ func ExampleIndexToCombination() {
}
func ExamplePermutations() {
- // combin provides several ways to work with the permutationss of
+ // combin provides several ways to work with the permutations of
// different objects. Permutations generates them directly.
fmt.Println("Generate list:")
n := 4

stat/combin: fix spelling