Answers whether both values are equal.
Orderingthe value to compare withReturns true when the values are equal.
What compare returns, #Less, #Equal or #Greater, and then for ordering by a second key.
How one value stands against another: below it, equal to it, or above it.
compare answers one of the three Cases. They are written Ordering#Less, Ordering#Equal and Ordering#Greater, and matched as case #Less. A match over them is checked for exhaustiveness like any other Choice.
Taught on: Protocols and Lists.
namespace Ordering for Orderingon Ordering · derived from Equatable
Answers whether both values are equal.
Orderingthe value to compare withReturns true when the values are equal.
on Ordering · derived from Printable
Answers the value as a String.
Returns the String representation of the value.
on Ordering · derived from Enumerable
Answers every value of the Type.
The values stand in the order the Cases are declared in. A Choice has at least one Case, so the answer certainly holds one.
Returns every Case of the Choice, in declaration order.
on Ordering · provided by Equatable
Answers whether the values differ.
Orderingthe value to compare withReturns true when the values differ.
on Ordering
Answers the ordering, or a second one where the first decides nothing.
Chaining the calls is how a sort orders on a second key, and then on a third. Each ordering after the first decides only what the ones before it left equal.
The next ordering is computed before the call, whether or not it is reached.
Orderingthe ordering to answer when this one is Ordering#EqualReturns the ordering itself, or the given one in its place.
The Function runs only where the first ordering is Ordering#Equal.
() -> Orderinganswers the ordering to use when this one is Ordering#EqualReturns the ordering itself, or the one the Function answers.