func (fns Fns) Search(slice, value interface{}) int {
	s := fns.mustSlice(reflect.ValueOf(slice))
	v := fns.mustValue(reflect.ValueOf(value))
	start, end := 0, s.Len()-1
	if start > end {
		return -1
	}
	for {
		i := int(uint(start+end) >> 1)  
		cmp := fns.compare(s.Index(i), v)
		switch {
		case cmp == 0:  
			return i
		case start == end:  
			return -1
		case cmp < 0:  
			start = i + 1
		default:  
			end = i - 1
		}
	}
}
Search searches the given slice for a value. The given slice should be sorted relative to the
comparsion function. It returns an index of an element that is equal to the given value. It
returns -1 if no element was found that is equal to the given value.
package order
import (
	"fmt"
	"reflect"
	"sort"
)
func By(fns ...interface{}) Fns {
	if len(fns) == 0 {
		panic("Expected at least one comparison function")
	}
	cmpFns := make(Fns, 0, len(fns))
	for i, fn := range fns {
		cmpFn, err := newFn(reflect.ValueOf(fn))
		if err != nil {
			panic(fmt.Sprintf("Invalid function %d: %s", i, err))
		}
		cmpFns, err = cmpFns.append(cmpFn)
		if err != nil {
			panic(err)
		}
	}
	return cmpFns
}
func (fns Fns) Reversed() Fns {
	newFns := make(Fns, len(fns))
	for i := range fns {
		original := fns[i]  
		newFns[i] = Fn{
			fn: func(lhs, rhs reflect.Value) int { return -original.fn(lhs, rhs) },
			t:  original.t,
		}
	}
	return newFns
}
func (fns Fns) Sort(slice interface{}) {
	sort.Slice(slice, fns.less(reflect.ValueOf(slice)))
}
func (fns Fns) SortStable(slice interface{}) {
	sort.SliceStable(slice, fns.less(reflect.ValueOf(slice)))
}
func (fns Fns) less(slice reflect.Value) func(i, j int) bool {
	s := fns.mustSlice(slice)
	return func(i, j int) bool {
		return fns.compare(s.Index(i), s.Index(j)) < 0
	}
}