-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposal
Milestone
Description
Proposal Details
An addition to the cmp package to support a common use case in ordered comparison.
func CompareBy[K cmp.Ordered, V any](key func(V) K) func(V, V) int {
return func(a, b V) int { return cmp.Compare(key(a), key(b)) }
}The majority of custom comparison functions apply the same transformation to each element. Analogous to Python's key functions, and would integrate well with Reverse proposed in #65632.
DeedleFake
Metadata
Metadata
Assignees
Labels
LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposal
Type
Projects
Status
Incoming