function eq
eq(
x: number,
y: number,
): boolean

Checks for equality between two values or arrays.

Compares two inputs, which can be numbers, arrays, or matrices, and returns true where the elements are equal.

Examples

Equality comparison between two numbers

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, 5), true);

Equality comparison between a number and an array

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [5, 6, 3]), [true, false, false]);

Equality comparison between a number and a matrix

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [[5, 6], [3, 5]]), [[true, false], [false, true]]);

Equality comparison between an array and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], 5), [true, false, false]);

Equality comparison between a matrix and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [3, 5]], 5), [[true, false], [false, true]]);

Equality comparison between two arrays

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], [2, 6, 0]), [false, true, false]);

Equality comparison between two matrices

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [-1, 2]], [[5, 6], [3, 5]]), [[true, true], [false, false]]);

Parameters

x: number

Left-hand side value(s) for comparison.

y: number

Right-hand side value(s) for comparison.

Return Type

boolean

The result of the equality comparison.

Throws

If fewer than two arguments are provided.

eq(
x: number,
y: array,
): array<boolean>

Checks for equality between two values or arrays.

Compares two inputs, which can be numbers, arrays, or matrices, and returns true where the elements are equal.

Examples

Equality comparison between two numbers

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, 5), true);

Equality comparison between a number and an array

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [5, 6, 3]), [true, false, false]);

Equality comparison between a number and a matrix

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [[5, 6], [3, 5]]), [[true, false], [false, true]]);

Equality comparison between an array and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], 5), [true, false, false]);

Equality comparison between a matrix and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [3, 5]], 5), [[true, false], [false, true]]);

Equality comparison between two arrays

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], [2, 6, 0]), [false, true, false]);

Equality comparison between two matrices

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [-1, 2]], [[5, 6], [3, 5]]), [[true, true], [false, false]]);

Parameters

x: number

Left-hand side value(s) for comparison.

Right-hand side value(s) for comparison.

Return Type

array<boolean>

The result of the equality comparison.

Throws

If fewer than two arguments are provided.

eq(
x: array,
y: number,
): array<boolean>

Checks for equality between two values or arrays.

Compares two inputs, which can be numbers, arrays, or matrices, and returns true where the elements are equal.

Examples

Equality comparison between two numbers

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, 5), true);

Equality comparison between a number and an array

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [5, 6, 3]), [true, false, false]);

Equality comparison between a number and a matrix

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [[5, 6], [3, 5]]), [[true, false], [false, true]]);

Equality comparison between an array and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], 5), [true, false, false]);

Equality comparison between a matrix and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [3, 5]], 5), [[true, false], [false, true]]);

Equality comparison between two arrays

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], [2, 6, 0]), [false, true, false]);

Equality comparison between two matrices

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [-1, 2]], [[5, 6], [3, 5]]), [[true, true], [false, false]]);

Parameters

Left-hand side value(s) for comparison.

y: number

Right-hand side value(s) for comparison.

Return Type

array<boolean>

The result of the equality comparison.

Throws

If fewer than two arguments are provided.

eq(
x: array,
y: array,
): array<boolean>

Checks for equality between two values or arrays.

Compares two inputs, which can be numbers, arrays, or matrices, and returns true where the elements are equal.

Examples

Equality comparison between two numbers

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, 5), true);

Equality comparison between a number and an array

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [5, 6, 3]), [true, false, false]);

Equality comparison between a number and a matrix

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [[5, 6], [3, 5]]), [[true, false], [false, true]]);

Equality comparison between an array and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], 5), [true, false, false]);

Equality comparison between a matrix and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [3, 5]], 5), [[true, false], [false, true]]);

Equality comparison between two arrays

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], [2, 6, 0]), [false, true, false]);

Equality comparison between two matrices

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [-1, 2]], [[5, 6], [3, 5]]), [[true, true], [false, false]]);

Parameters

Left-hand side value(s) for comparison.

Right-hand side value(s) for comparison.

Return Type

array<boolean>

The result of the equality comparison.

Throws

If fewer than two arguments are provided.

eq(
x: number,
y: matrix,
): matrix<boolean>

Checks for equality between two values or arrays.

Compares two inputs, which can be numbers, arrays, or matrices, and returns true where the elements are equal.

Examples

Equality comparison between two numbers

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, 5), true);

Equality comparison between a number and an array

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [5, 6, 3]), [true, false, false]);

Equality comparison between a number and a matrix

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [[5, 6], [3, 5]]), [[true, false], [false, true]]);

Equality comparison between an array and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], 5), [true, false, false]);

Equality comparison between a matrix and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [3, 5]], 5), [[true, false], [false, true]]);

Equality comparison between two arrays

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], [2, 6, 0]), [false, true, false]);

Equality comparison between two matrices

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [-1, 2]], [[5, 6], [3, 5]]), [[true, true], [false, false]]);

Parameters

x: number

Left-hand side value(s) for comparison.

Right-hand side value(s) for comparison.

Return Type

matrix<boolean>

The result of the equality comparison.

Throws

If fewer than two arguments are provided.

eq(
x: matrix,
y: number,
): matrix<boolean>

Checks for equality between two values or arrays.

Compares two inputs, which can be numbers, arrays, or matrices, and returns true where the elements are equal.

Examples

Equality comparison between two numbers

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, 5), true);

Equality comparison between a number and an array

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [5, 6, 3]), [true, false, false]);

Equality comparison between a number and a matrix

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [[5, 6], [3, 5]]), [[true, false], [false, true]]);

Equality comparison between an array and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], 5), [true, false, false]);

Equality comparison between a matrix and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [3, 5]], 5), [[true, false], [false, true]]);

Equality comparison between two arrays

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], [2, 6, 0]), [false, true, false]);

Equality comparison between two matrices

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [-1, 2]], [[5, 6], [3, 5]]), [[true, true], [false, false]]);

Parameters

Left-hand side value(s) for comparison.

y: number

Right-hand side value(s) for comparison.

Return Type

matrix<boolean>

The result of the equality comparison.

Throws

If fewer than two arguments are provided.

eq(
x: matrix,
y: matrix,
): matrix<boolean>

Checks for equality between two values or arrays.

Compares two inputs, which can be numbers, arrays, or matrices, and returns true where the elements are equal.

Examples

Equality comparison between two numbers

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, 5), true);

Equality comparison between a number and an array

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [5, 6, 3]), [true, false, false]);

Equality comparison between a number and a matrix

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq(5, [[5, 6], [3, 5]]), [[true, false], [false, true]]);

Equality comparison between an array and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], 5), [true, false, false]);

Equality comparison between a matrix and a number

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [3, 5]], 5), [[true, false], [false, true]]);

Equality comparison between two arrays

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([5, 6, 3], [2, 6, 0]), [false, true, false]);

Equality comparison between two matrices

import { assertEquals } from "jsr:@std/assert";

assertEquals(eq([[5, 6], [-1, 2]], [[5, 6], [3, 5]]), [[true, true], [false, false]]);

Parameters

Left-hand side value(s) for comparison.

Right-hand side value(s) for comparison.

Return Type

matrix<boolean>

The result of the equality comparison.

Throws

If fewer than two arguments are provided.

Usage

import eq from "elemop/eq.ts";