Closed Frassle closed 7 months ago
A helpful wrapper around https://pkg.go.dev/slices@go1.21.1#Sort. I could add SortedFunc as well if wanted to wrap https://pkg.go.dev/slices@go1.21.1#SortFunc.
@Frassle - thanks for your contribution. This seems like a nice and convenient helper func. I’ll look it over in detail along with your other posted issue likely tomorrow.
Thanks for your interest and contribution!
Noticed from your CI run that "slices" and "cmp" are only in go 1.21 so I've moved this to a new file that can be conditional by version. Won't break existing users, but anyone wanting to use sorted will need to be on 1.21.
Hey @deckarep just to check in if you've had a chance to consider this yet?
Thanks @Frassle for this change. Sorry I never got around to it but it looks good. Thanks @funwithbots for the pair of eyes.
This will show up in release: v2.5.0
Thanks! And no worries about the time, I know how easy it is to lose track of things like this.
This is a set variant on
slices.Sort
that makes it easy to get a sorted slice. This makes it easy to get the elements of the set into a sorted slice. Quite handy when using sets to build up unique elements but then needing a well defined iteration order.