Closed ManevilleF closed 3 months ago
Hmm. I think this is mildly useful, but not worth including in the library. These are really trivial to add to end user code.
I would consider adding the OrderByLength
impl to Hex
itself (since it's a good default + in many cases you don't care what the ordering is, just that it is orderable).
I'm not sure if there is a good default, like if you retrieve a hex ring around zero all coordinates will have the same length while not being equal, only YX or XY would give consistent results with Equality comparison
Proposal to implement ordering for
Hex
coordinates (See #146)Add wrappers aroundHex
implementingPartialOrd
andOrd
ordering by length:OrdByLength
ordering by x then y:OrdByXY
ordering by y then x:OrdByYX
EDIT: I added an explicative section in the README