Trait in prelude::ops auto-imported

Le

trait Le<T>
Source: compiler/src/builtin_docs/prelude/ops.hy

The less-or-equal operator <=.

a <= b on a type with an Le instance calls le(a, b).

Required methods#

NameDescription
leReturns true when a is less than or equal to b.

Examples#

use tests::assert;
class Version {
    pub n: int,
}

impl Le for Version {
    pub fn le(Version a, Version b) -> bool {
        return a.n <= b.n;
    }
}

fn main() {
    assert!(new Version(2) <= new Version(2));
}

See also#

  • Add: The addition operator +.
  • Sub: The subtraction operator -.
  • Mul: The multiplication operator *.
  • Div: The division operator /.
  • Neg: The unary negation operator -x.
  • Rem: The remainder operator %.
  • Pow: The exponentiation operator **.
  • Num: The numeric bundle: Add, Sub, Mul, Div, Neg, Rem and Pow.
↑ ↓ navigate ↵ open