MCPcopy Create free account
hub / github.com/encodeous/nylon / SortPairs

Function SortPairs

state/pair.go:14–20  ·  view source on GitHub ↗
(pairs []Pair[T, T])

Source from the content-addressed store, hash-verified

12}
13
14func SortPairs[T cmp.Ordered](pairs []Pair[T, T]) {
15 sort.Slice(pairs, func(i, j int) bool {
16 x := cmp.Compare(pairs[i].V1, pairs[j].V1)
17 y := cmp.Compare(pairs[i].V2, pairs[j].V2)
18 return x < 0 || x == 0 && y < 0
19 })
20}

Callers 3

TestSortPairsIntFunction · 0.85
TestSortPairsStringFunction · 0.85
ParseGraphFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestSortPairsIntFunction · 0.68
TestSortPairsStringFunction · 0.68