Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on JavaScript: The Curious Case of null >= 0. Parent comment
Define X < Y, and then derive the rest:
X > Y : X < Y
X == Y: !(X < Y) && !(Y > X)
X != Y: !(X == Y)
X >= Y: !(X < Y)
X <= Y: !(Y < X)
That's why it's the only operator that needs to be defined for std::map/set (which are rb-trees) in C++
Now, if X and Y aren't the same type, the only thing you can expect to get out of the system is a cronenberg.
Only for totally ordered sets [1]. Floating-point numbers, for example, are not totally ordered, because !(NaN == NaN).
[1] https://en.wikipedia.org/wiki/Total_order
Define X < Y, and then derive the rest:
X > Y : X < Y
X == Y: !(X < Y) && !(Y > X)
X != Y: !(X == Y)
X >= Y: !(X < Y)
X <= Y: !(Y < X)
That's why it's the only operator that needs to be defined for std::map/set (which are rb-trees) in C++
Now, if X and Y aren't the same type, the only thing you can expect to get out of the system is a cronenberg.