aboutsummaryrefslogtreecommitdiff
path: root/lib/strings
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-05-20 13:42:39 +0700
committerShulhan <ms@kilabit.info>2023-05-20 13:44:07 +0700
commit3eae1d3df5eeef14f9e8389895bb6b835ac2cf78 (patch)
treef35ca6c111bed2ecf85ada965accf22ce83d3e8c /lib/strings
parentf43b8ead50575c6a279bef403af0204df98323c9 (diff)
downloadpakakeh.go-3eae1d3df5eeef14f9e8389895bb6b835ac2cf78.tar.xz
all: remove any usage of debug.Value in all packages
Using global debug value for all packages turns out is not a good idea.
Diffstat (limited to 'lib/strings')
-rw-r--r--lib/strings/table.go40
1 files changed, 0 insertions, 40 deletions
diff --git a/lib/strings/table.go b/lib/strings/table.go
index c020b1ac..21e25e28 100644
--- a/lib/strings/table.go
+++ b/lib/strings/table.go
@@ -4,12 +4,6 @@
package strings
-import (
- "fmt"
-
- "github.com/shuLhan/share/lib/debug"
-)
-
// Table is for working with set of row.
//
// Each element in table is in the form of
@@ -20,14 +14,6 @@ import (
// ]
type Table []Row
-// createIndent create n space indentation and return it.
-func createIndent(n int) (s string) {
- for i := 0; i < n; i++ {
- s += " "
- }
- return
-}
-
// Partition group the each element of slice "ss" into non-empty
// record, in such a way that every element is included in one and only of the
// record.
@@ -45,10 +31,6 @@ func Partition(ss []string, k int) (table Table) {
seed := make([]string, n)
copy(seed, ss)
- if debug.Value >= 1 {
- fmt.Printf("lib/strings: %s Partition(%v,%v)\n", createIndent(n), n, k)
- }
-
// if only one split return the set contain only seed as list.
// input: {a,b,c}, output: {{a,b,c}}
if k == 1 {
@@ -72,31 +54,14 @@ func Partition(ss []string, k int) (table Table) {
// remove the first element from set
seed = append(seed[:0], seed[1:]...)
- if debug.Value >= 1 {
- fmt.Printf("[tekstus] %s el: %s, seed: %s", createIndent(n), el, seed)
- }
-
// generate child list
genTable := Partition(seed, k)
- if debug.Value >= 1 {
- fmt.Printf("[tekstus] %s genTable join: %v", createIndent(n), genTable)
- }
-
// join elemen with generated set
table = genTable.JoinCombination(el)
- if debug.Value >= 1 {
- fmt.Printf("[tekstus] %s join %s : %v\n", createIndent(n), el,
- table)
- }
-
genTable = Partition(seed, k-1)
- if debug.Value >= 1 {
- fmt.Printf("[tesktus] %s genTable append: %s", createIndent(n), genTable)
- }
-
for _, row := range genTable {
list := make(Row, len(row))
copy(list, row)
@@ -104,11 +69,6 @@ func Partition(ss []string, k int) (table Table) {
table = append(table, list)
}
- if debug.Value >= 1 {
- fmt.Printf("[tesktus] %s append %v : %v\n", createIndent(n), el,
- table)
- }
-
return table
}