From 7e0ae5d58eb25f7fd049c026b60aaa934694424d Mon Sep 17 00:00:00 2001 From: MSilva95 Date: Mon, 6 Jul 2020 15:48:11 +0100 Subject: [PATCH 1/4] adding spaces in the output --- go/tests/prog/range_prog/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/tests/prog/range_prog/main.go b/go/tests/prog/range_prog/main.go index a65297e6..02053d61 100644 --- a/go/tests/prog/range_prog/main.go +++ b/go/tests/prog/range_prog/main.go @@ -23,7 +23,7 @@ func main() { return } for _, i := range lib.IntRange(a, b) { - fmt.Print(i) + fmt.Print(i, " ") } fmt.Println() } From 99bd92bcb98c72980c15a228179d61fc19c7a678 Mon Sep 17 00:00:00 2001 From: MSilva95 Date: Mon, 6 Jul 2020 16:16:18 +0100 Subject: [PATCH 2/4] adding spaces in the output --- go/tests/prog/range_prog/main.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/go/tests/prog/range_prog/main.go b/go/tests/prog/range_prog/main.go index 02053d61..50065842 100644 --- a/go/tests/prog/range_prog/main.go +++ b/go/tests/prog/range_prog/main.go @@ -4,8 +4,6 @@ import ( "fmt" "os" "strconv" - - "lib" ) func main() { @@ -22,8 +20,14 @@ func main() { fmt.Println(err) return } - for _, i := range lib.IntRange(a, b) { - fmt.Print(i, " ") + fmt.Print(a) + for b != a { + if a < b { + a++ + } else { + a-- + } + fmt.Print(" ", a) } fmt.Println() } From 36ae5dcbf53c719f106e7be1c4272035167278f5 Mon Sep 17 00:00:00 2001 From: MSilva95 Date: Tue, 7 Jul 2020 16:57:54 +0100 Subject: [PATCH 3/4] fix test of the grouping exercise --- go/tests/prog/grouping_prog/main.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/go/tests/prog/grouping_prog/main.go b/go/tests/prog/grouping_prog/main.go index b953ef0d..011224ca 100644 --- a/go/tests/prog/grouping_prog/main.go +++ b/go/tests/prog/grouping_prog/main.go @@ -45,17 +45,16 @@ func brackets(regexp, text string) { runes = runes[1 : len(runes)-1] result := simpleSearch(runes, text) for i, s := range result { - if !unicode.Is(unicode.Hex_Digit, rune(s[len(s)-1])) { - s = s[:len(s)-1] + if !unicode.Is(unicode.Hex_Digit, rune(s[len(s)-1])) && !unicode.IsLetter(rune(s[len(s)-1])) { + s = s[0 : len(s)-1] } if !unicode.Is(unicode.Hex_Digit, rune(s[0])) { - s = s[1:] + s = s[0:] } fmt.Printf("%d: %s\n", i+1, s) } } } - func main() { // brackets("al|b", "ale atg bar sim nao pro par impar") In JS it's used without brackets if len(os.Args) == 3 { From b50995c2e9a2e758f80498ae9876666935eb638d Mon Sep 17 00:00:00 2001 From: MSilva95 Date: Wed, 8 Jul 2020 10:28:47 +0100 Subject: [PATCH 4/4] removing some code --- go/tests/prog/grouping_prog/main.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/go/tests/prog/grouping_prog/main.go b/go/tests/prog/grouping_prog/main.go index 011224ca..718710b5 100644 --- a/go/tests/prog/grouping_prog/main.go +++ b/go/tests/prog/grouping_prog/main.go @@ -48,9 +48,6 @@ func brackets(regexp, text string) { if !unicode.Is(unicode.Hex_Digit, rune(s[len(s)-1])) && !unicode.IsLetter(rune(s[len(s)-1])) { s = s[0 : len(s)-1] } - if !unicode.Is(unicode.Hex_Digit, rune(s[0])) { - s = s[0:] - } fmt.Printf("%d: %s\n", i+1, s) } }