Comparison functions for equality and ordering.
Functions
between core
fn (x: Int | Dec, low: Int | Dec, high: Int | Dec): Bool
Return true if x is between low and high (inclusive).
Example
between(5, 1, 10) // true
between(1, 1, 10) // true (inclusive)
between(10, 1, 10) // true (inclusive)
between(0, 1, 10) // false
between(3.14, 3.0, 4.0) // true
eq core
fn (a: Any)
fn (a: Any, b: Any)
fn (a: Any, b: Any, c: Any, ...rest: Any)
Return true if all the values are equal. One value is equal to itself.
Example
eq(1, 1) // true
eq(1, 2) // false
eq("hi", "hi") // true
eq([1, 2], [1, 2]) // true
eq(1, 1, 1) // true
eq(1, 1, 2) // false
gt core
fn (a: Int | Dec)
fn (a: Int | Dec, b: Int | Dec)
fn (a: Int | Dec, b: Int | Dec, c: Int | Dec, ...rest: Int | Dec)
Return true if each number is greater than the next, so gt(...xs) checks
a whole Vec that has at least one number: with none, the call fails. One
number has nothing to compare with, so it is true.
Example
gt(5, 3) // true
gt(3, 5) // false
gt(3, 3) // false
gt(2.5, 2) // true
gt(3, 2, 1) // true
gt(3, 3, 1) // false
gte core
fn (a: Int | Dec)
fn (a: Int | Dec, b: Int | Dec)
fn (a: Int | Dec, b: Int | Dec, c: Int | Dec, ...rest: Int | Dec)
Return true if each number is greater than or equal to the next, so gte(...xs) checks
a whole Vec that has at least one number: with none, the call fails. One
number has nothing to compare with, so it is true.
Example
gte(5, 3) // true
gte(3, 3) // true
gte(2, 5) // false
gte(3, 3, 1) // true
gte(3, 1, 2) // false
in core
fn (value: Any, coll: Vec): Bool
Return true if value is an element of coll.
Example
in(2, [1, 2, 3]) // true
in(4, [1, 2, 3]) // false
in("a", ["a", "b"]) // true
in(1, []) // false
lt core
fn (a: Int | Dec)
fn (a: Int | Dec, b: Int | Dec)
fn (a: Int | Dec, b: Int | Dec, c: Int | Dec, ...rest: Int | Dec)
Return true if each number is less than the next, so lt(...xs) checks
a whole Vec that has at least one number: with none, the call fails. One
number has nothing to compare with, so it is true.
Example
lt(3, 5) // true
lt(5, 3) // false
lt(3, 3) // false
lt(1, 2, 3) // true
lt(1, 3, 2) // false
lte core
fn (a: Int | Dec)
fn (a: Int | Dec, b: Int | Dec)
fn (a: Int | Dec, b: Int | Dec, c: Int | Dec, ...rest: Int | Dec)
Return true if each number is less than or equal to the next, so lte(...xs) checks
a whole Vec that has at least one number: with none, the call fails. One
number has nothing to compare with, so it is true.
Example
lte(3, 5) // true
lte(3, 3) // true
lte(5, 3) // false
lte(1, 1, 2) // true
lte(2, 1, 3) // false
ne core
fn (a: Any)
fn (a: Any, b: Any)
fn (a: Any, b: Any, c: Any, ...rest: Any)
Return true if the values aren't all equal, the opposite of eq. That
isn't "all different": ne(1, 2, 1) is true though two of them match.
Example
ne(1, 2) // true
ne(1, 1) // false
ne("a", "b") // true
ne(1, 1, 2) // true
ne(1, 1, 1) // false