diff options
Diffstat (limited to 'src/pkg/sort/search.go')
-rw-r--r-- | src/pkg/sort/search.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pkg/sort/search.go b/src/pkg/sort/search.go index b3ddd2dfa..6828e19b6 100644 --- a/src/pkg/sort/search.go +++ b/src/pkg/sort/search.go @@ -74,7 +74,7 @@ func Search(n int, f func(int) bool) int { // Convenience wrappers for common cases. -// SearchInts searches x in a sorted slice of ints and returns the index +// 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. // func SearchInts(a []int, x int) int { @@ -82,15 +82,15 @@ func SearchInts(a []int, x int) int { } -// SearchFloats searches x in a sorted slice of floats and returns the index +// 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. // -func SearchFloats(a []float, x float) int { +func SearchFloat64s(a []float64, x float64) int { return Search(len(a), func(i int) bool { return a[i] >= x }) } -// SearchStrings searches x in a sorted slice of strings and returns the index +// 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. // func SearchStrings(a []string, x string) int { @@ -102,8 +102,8 @@ func SearchStrings(a []string, x string) int { func (p IntArray) Search(x int) int { return SearchInts(p, x) } -// Search returns the result of applying SearchFloats to the receiver and x. -func (p FloatArray) Search(x float) int { return SearchFloats(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) } // Search returns the result of applying SearchStrings to the receiver and x. |