The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

core.compare

Exports functions for performing various types of vaue comparisons.

eq

Description

String equality test. Returns 1 if both operands are the same in a string context, 0 if they are not.

Usage

<operand> <operand>

lt

Description

String ordinality test. Returns 1 if ``a`` sorts before ``b`` according to the collation rules of the locale in which the bot is running. Returns 0 otherwise.

Usage

<operand a> <operand b>

Examples

(lt "abc" "def")

gt

Description

String ordinality test. Returns 1 if ``a`` sorts after ``b`` according to the collation rules of the locale in which the bot is running. Returns 0 otherwise.

Usage

<operand a> <operand b>

Examples

(gt "zyx" "abc")

ne

Description

String inequaity test. Returns 1 if both operands are different in a string context, 0 otherwise.

Usage

<operand a> <operand b>

cmp

Description

String comparison. Returns -1 if ``a`` collates before ``b``, 1 if ``b`` collates first, and 0 if they are equal. Collation uses the locale under which the bot is running.

Usage

<operand a> <operand b>

==

Description

Numeric equality test. Returns 1 if both operands the same numerically, 0 otherwise.

Usage

<operand a> <operand b>

Examples

(== 1 1.0000000)

<

Description

Numeric less-than test. Returns 1 if ``a`` is less than ``b``, 0 otherwise.

Usage

<operand a> <operand b>

Examples

(< 1 2)

>

Description

Numeric greater-than test. Returns 1 if ``a`` is greater than ``b``, 0 otherwise.

Usage

<operand a> <operand b>

Examples

(> 50 10)

!=

Description

Numeric inequality test. Returns 1 if both operands are different numbers, 0 otherwise.

Usage

<operand a> <operand b>

Examples

(!= 0.1 1.0)