outrun/lib/greater_or_equal.run

17 lines
819 B
Text

```doc
# GreaterOrEqual
Values which implement the `>=` infix operator must implement this protocol.
If the value also implements the `Greater` and `Equality` protocols then this protocol can be automatically implemented.
```
protocol GreaterOrEqual, requires: Greater + Equality, as:
```doc
Compare `lhs` and `rhs` returning a boolean.
The default implementation delegates to the `Greater` and `Equality` protocols, however you should probably implement this function as a single comparison is more than likely much faster.
```
def greater_or_equal?(self: Greater, other: Any): Boolean, when: Greater.greater?(self, other), as: true
def greater_or_equal?(self: Equality, other: Any): Boolean, when: Equality.equal?(self, other), as: true
def greater_or_equal?(_self: Self, _other: Any), as: false
end