aboutsummaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorEli Bendersky <eliben@golang.org>2023-05-19 10:10:21 -0700
committerEli Bendersky <eliben@google.com>2023-05-23 23:33:29 +0000
commit0df681248862a34ff1233cdc4cf0b036e4761652 (patch)
tree2b0f8384198d97d23c7d1ee7d28fa9f43ed535f3 /api
parent6b7aab7750a8b41b15bac4d598470883c245a0d7 (diff)
downloadgo-0df681248862a34ff1233cdc4cf0b036e4761652.tar.gz
go-0df681248862a34ff1233cdc4cf0b036e4761652.zip
slices: add sorting and comparison functions
Now that the `cmp` package exists, sorting and comparison functions from `x/exp/slices` can be ported to the standard library, using the `cmp.Ordered` type and the `cmp.Less` and `cmp.Compare` functions. This move also includes adjustments to the discussions in #60091 w.r.t. NaN handling and cmp vs. less functions, and adds Min/Max functions. The final API is taken from https://github.com/golang/go/issues/60091#issuecomment-1553850782 Updates #60091 Change-Id: Id7e6c88035b60d4ddd0c48dd82add8e8bc4e22d3 Reviewed-on: https://go-review.googlesource.com/c/go/+/496078 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Eli Bendersky <eliben@google.com> Run-TryBot: Eli Benderskyā€ˇ <eliben@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'api')
-rw-r--r--api/next/60091.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/api/next/60091.txt b/api/next/60091.txt
new file mode 100644
index 0000000000..36c05a27f5
--- /dev/null
+++ b/api/next/60091.txt
@@ -0,0 +1,13 @@
+pkg slices, func BinarySearchFunc[$0 interface{}, $1 interface{}]([]$0, $1, func($0, $1) int) (int, bool) #60091
+pkg slices, func BinarySearch[$0 cmp.Ordered]([]$0, $0) (int, bool) #60091
+pkg slices, func CompareFunc[$0 interface{}, $1 interface{}]([]$0, []$1, func($0, $1) int) int #60091
+pkg slices, func Compare[$0 cmp.Ordered]([]$0, []$0) int #60091
+pkg slices, func IsSortedFunc[$0 interface{}]([]$0, func($0, $0) int) bool #60091
+pkg slices, func IsSorted[$0 cmp.Ordered]([]$0) bool #60091
+pkg slices, func MaxFunc[$0 interface{}]([]$0, func($0, $0) int) $0 #60091
+pkg slices, func Max[$0 cmp.Ordered]([]$0) $0 #60091
+pkg slices, func MinFunc[$0 interface{}]([]$0, func($0, $0) int) $0 #60091
+pkg slices, func Min[$0 cmp.Ordered]([]$0) $0 #60091
+pkg slices, func SortFunc[$0 interface{}]([]$0, func($0, $0) int) #60091
+pkg slices, func SortStableFunc[$0 interface{}]([]$0, func($0, $0) int) #60091
+pkg slices, func Sort[$0 cmp.Ordered]([]$0) #60091