aboutsummaryrefslogtreecommitdiff
path: root/src/slices/sort.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/slices/sort.go')
-rw-r--r--src/slices/sort.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/slices/sort.go b/src/slices/sort.go
index 24fc6e26b6..af1d51ecd4 100644
--- a/src/slices/sort.go
+++ b/src/slices/sort.go
@@ -70,7 +70,8 @@ func Min[S ~[]E, E cmp.Ordered](x S) E {
}
// MinFunc returns the minimal value in x, using cmp to compare elements.
-// It panics if x is empty.
+// It panics if x is empty. If there is more than one minimal element
+// according to the cmp function, MinFunc returns the first one.
func MinFunc[S ~[]E, E any](x S, cmp func(a, b E) int) E {
if len(x) < 1 {
panic("slices.MinFunc: empty list")
@@ -99,7 +100,8 @@ func Max[S ~[]E, E cmp.Ordered](x S) E {
}
// MaxFunc returns the maximal value in x, using cmp to compare elements.
-// It panics if x is empty.
+// It panics if x is empty. If there is more than one maximal element
+// according to the cmp function, MaxFunc returns the first one.
func MaxFunc[S ~[]E, E any](x S, cmp func(a, b E) int) E {
if len(x) < 1 {
panic("slices.MaxFunc: empty list")