2022-09-07 04:28:13 +00:00
|
|
|
package fixedpoint
|
|
|
|
|
|
|
|
type Slice []Value
|
|
|
|
|
2022-09-07 06:00:26 +00:00
|
|
|
func (s Slice) Reduce(reducer Reducer, a ...Value) Value {
|
|
|
|
return Reduce(s, reducer, a...)
|
2022-09-07 04:28:13 +00:00
|
|
|
}
|
2022-09-07 04:35:09 +00:00
|
|
|
|
|
|
|
// Defaults to ascending sort
|
|
|
|
func (s Slice) Len() int { return len(s) }
|
|
|
|
func (s Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
|
|
|
func (s Slice) Less(i, j int) bool { return s[i].Compare(s[j]) < 0 }
|
|
|
|
|
|
|
|
type Ascending []Value
|
|
|
|
|
|
|
|
func (s Ascending) Len() int { return len(s) }
|
|
|
|
func (s Ascending) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
|
|
|
func (s Ascending) Less(i, j int) bool { return s[i].Compare(s[j]) < 0 }
|
|
|
|
|
|
|
|
type Descending []Value
|
|
|
|
|
|
|
|
func (s Descending) Len() int { return len(s) }
|
|
|
|
func (s Descending) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
|
|
|
func (s Descending) Less(i, j int) bool { return s[i].Compare(s[j]) > 0 }
|