cat(): array | matrix
Concatenates arrays and matrices along the specified dimension.
Concatenates arrays and matrices along the specified dimension. Supports vertical (0) and horizontal (1) concatenation.
Vertical Concatenation (dim = 0) with numbers
Vertical Concatenation (dim = 0) with numbers
import { assertEquals } from "jsr:@std/assert"; assertEquals(cat(0, 1, 2, 3, 4), [[1], [2], [3], [4]]);
Vertical Concatenation (dim = 0) with arrays
Vertical Concatenation (dim = 0) with arrays
import { assertEquals } from "jsr:@std/assert"; assertEquals(cat(0, [5, 6, 3], [0.5, -3, 2.3]), [[5, 6, 3], [0.5, -3, 2.3]]);
Vertical Concatenation (dim = 0) with matrix and array
Vertical Concatenation (dim = 0) with matrix and array
import { assertEquals } from "jsr:@std/assert"; const result3 = cat(0, [[5, 6, 5], [7, 8, -1]], [5, 6, 3]); assertEquals(result3, [[5, 6, 5], [7, 8, -1], [5, 6, 3]]);
Horizontal Concatenation (dim = 1) with numbers
Horizontal Concatenation (dim = 1) with numbers
import { assertEquals } from "jsr:@std/assert"; assertEquals(cat(1, 1, 2, 3, 4), [[1, 2, 3, 4]]);