Settings

Theme

Show HN: Unicmp – fast universal ordering function for Go

pkg.go.dev

3 points by Snawoot 7 months ago · 0 comments · 1 min read

Reader

Have you ever wanted something `comparable` to be also ordered, e.g. for canonicalization sort or sorted collections? This function uses fast runtime's map hash (with rare exceptions) for comparisons of arbitrary values, providing strict ordering for any `comparable` type.

In other words, it's like `cmp.Compare` from Go's stdlib expanded to every `comparable` type, not just strings and numbers.

No comments yet.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection