Technically inaccurate, slightly unhelpful hint on the Poker exercise on the Rust Track

The hint for the poker exercise mentions that “Ord types form a total order”, which is the very simplification the rust documentation does. This isn’t entirely accurate though, as the trait Ord only defines a total order if the trait Eq defines an equality, and not an equivalence relation, as clarified in the Rust Documentation.

This would seem pure and complete pedantry if the exercise didn’t, very naturally, induce the equivalence relation of two poker hands being related if, and only if, they tie. This allows for un-cumbersome use of not only sort, but also max, besides being a modeling that feels more representative to how poker hands compare (i.e. you either win, lose, or tie being represented by >, < and ==).

Moved to the Rust category as the hints are specific to the track and not part of the problem specs.

3 Likes

Sorry about that, and thank you for the move!

Today I learned! Would you like to contribute the improved hint? PR welcome.

PS: Sorry for the late response, I stopped receiving emails from the forum for some reason.

Made a PR here: poker: remove incorrect hints about total order by senekor · Pull Request #2177 · exercism/rust · GitHub

2 Likes