Skip to content

Commit 4283ced

Browse files
committed
minor changes
1 parent 3afe514 commit 4283ced

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/bundles/matrix/src/functions.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { GeneralRuntimeError, InvalidParameterTypeError } from '@sourceacademy/modules-lib/errors';
2-
import { assertFunctionOfLength, assertNumberWithinRange, isFunctionOfLength, isNumberWithinRange } from '@sourceacademy/modules-lib/utilities';
2+
import { assertFunctionOfLength, assertNumberWithinRange, isFunctionOfLength, isNumberWithinRange, wrapFunction } from '@sourceacademy/modules-lib/utilities';
33
import { head, is_pair, pair, tail, type List, type Pair } from 'js-slang/dist/stdlib/list';
44
import { Matrix, type CellCallback } from './types';
55

@@ -38,9 +38,11 @@ export const MAX_COLS: number = 256;
3838
* Creates a 2D matrix with the given number of rows and columns
3939
* @param rows Number of rows between 1 and {@link MAX_ROWS}
4040
* @param cols Number of columns between 1 and {@link MAX_COLS}
41+
* @param name Optional name for the matrix
4142
* @returns Matrix
43+
* @function
4244
*/
43-
export function create_matrix(rows: number, cols: number, name: string | undefined): Matrix {
45+
export const create_matrix = wrapFunction((rows: number, cols: number, name?: string): Matrix => {
4446
assertNumberWithinRange(rows, create_matrix.name, 1, MAX_ROWS, true, 'rows');
4547
assertNumberWithinRange(cols, create_matrix.name, 1, MAX_COLS, true, 'cols');
4648

@@ -69,7 +71,7 @@ export function create_matrix(rows: number, cols: number, name: string | undefin
6971
cols,
7072
[],
7173
);
72-
}
74+
}, 1);
7375

7476
/**
7577
* Creates a copy of an existing matrix. The copy will not have the existing's registered buttons

src/tabs/Matrix/src/MatrixDisplay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Matrix } from '@sourceacademy/bundle-matrix/types';
2-
import range from 'lodash/range';
2+
import { range } from 'es-toolkit';
33
import IndexLabel from './IndexLabel';
44
import MatrixButton from './MatrixButton';
55
import { getDefaultCellCallback, getDefaultColCallback, getDefaultRowCallback } from './callbacks';

0 commit comments

Comments
 (0)