diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-08-03 16:54:30 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-08-03 16:54:30 +0200 |
commit | 28592ee1ea1f5cdffcf85472f9de0285d928cf12 (patch) | |
tree | 32944e18b23f7fe4a0818a694aa2a6dfb1835463 /src/pkg/sort/search.go | |
parent | e836bee4716dc0d4d913537ad3ad1925a7ac32d0 (diff) | |
download | golang-upstream/59.tar.gz |
Imported Upstream version 59upstream/59
Diffstat (limited to 'src/pkg/sort/search.go')
-rw-r--r-- | src/pkg/sort/search.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pkg/sort/search.go b/src/pkg/sort/search.go index 6828e19b6..7d468da8a 100644 --- a/src/pkg/sort/search.go +++ b/src/pkg/sort/search.go @@ -15,7 +15,7 @@ package sort // Search calls f(i) only for i in the range [0, n). // // A common use of Search is to find the index i for a value x in -// a sorted, indexable data structure like an array or slice. +// a sorted, indexable data structure such as an array or slice. // In this case, the argument f, typically a closure, captures the value // to be searched for, and how the data structure is indexed and // ordered. @@ -75,7 +75,7 @@ func Search(n int, f func(int) bool) int { // Convenience wrappers for common cases. // SearchInts searches for x in a sorted slice of ints and returns the index -// as specified by Search. The array must be sorted in ascending order. +// as specified by Search. The slice must be sorted in ascending order. // func SearchInts(a []int, x int) int { return Search(len(a), func(i int) bool { return a[i] >= x }) @@ -83,15 +83,15 @@ func SearchInts(a []int, x int) int { // SearchFloat64s searches for x in a sorted slice of float64s and returns the index -// as specified by Search. The array must be sorted in ascending order. +// as specified by Search. The slice must be sorted in ascending order. // func SearchFloat64s(a []float64, x float64) int { return Search(len(a), func(i int) bool { return a[i] >= x }) } -// SearchStrings searches for x in a sorted slice of strings and returns the index -// as specified by Search. The array must be sorted in ascending order. +// SearchStrings searches for x slice a sorted slice of strings and returns the index +// as specified by Search. The slice must be sorted in ascending order. // func SearchStrings(a []string, x string) int { return Search(len(a), func(i int) bool { return a[i] >= x }) @@ -99,12 +99,12 @@ func SearchStrings(a []string, x string) int { // Search returns the result of applying SearchInts to the receiver and x. -func (p IntArray) Search(x int) int { return SearchInts(p, x) } +func (p IntSlice) Search(x int) int { return SearchInts(p, x) } // Search returns the result of applying SearchFloat64s to the receiver and x. -func (p Float64Array) Search(x float64) int { return SearchFloat64s(p, x) } +func (p Float64Slice) Search(x float64) int { return SearchFloat64s(p, x) } // Search returns the result of applying SearchStrings to the receiver and x. -func (p StringArray) Search(x string) int { return SearchStrings(p, x) } +func (p StringSlice) Search(x string) int { return SearchStrings(p, x) } |