From 28592ee1ea1f5cdffcf85472f9de0285d928cf12 Mon Sep 17 00:00:00 2001 From: Ondřej Surý Date: Wed, 3 Aug 2011 16:54:30 +0200 Subject: Imported Upstream version 59 --- src/pkg/sort/search.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/pkg/sort/search.go') 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) } -- cgit v1.2.3