fix: coding style and file format for chapter 7.

This commit is contained in:
Bo-Yi Wu
2017-02-11 12:26:05 +08:00
parent d9041c7fc3
commit e6d601d3a1
15 changed files with 375 additions and 375 deletions

View File

@@ -9,5 +9,4 @@ func main() {
}
fmt.Println(arr) // [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14]
}

View File

@@ -18,7 +18,7 @@ func main() {
fmt.Printf("%v", mapFunc(mf, list))
}
func mapFunc(mf func(int) int, list []int) ([]int) {
func mapFunc(mf func(int) int, list []int) []int {
result := make([]int, len(list))
for ix, v := range list {
result[ix] = mf(v)

View File

@@ -34,6 +34,7 @@ func main() {
s := "My Test String!"
fmt.Println(s, " --> ", reverse(s))
}
/* Output:
The reversed string is -elgooG-
The reversed string is -elgooG-

View File

@@ -12,4 +12,5 @@ func Split2(s string) string {
mid := len(s) / 2
return s[mid:] + s[:mid]
}
// Output: The string Google transformed is: gleGoo

View File

@@ -36,4 +36,3 @@ func SumAndAverage (a []int) (int, float32) {
}
return sum, float32(sum / len(a))
}