This file implements matrices as lists of lists. Note that this is a functional implementation used to demonstrate how to manipulate lists in a functional manner (using listMap and listReduce) and not an efficient implementation of matrices computations.

Here is a manner to create and display a matrix :

import { cons, nil } from '#src/utils/list.functional.api.js';
import { matrixDisp } from '#src/utils/matrix.js';

const aLine1 = cons(1, cons(2, cons(3,nil))); // (|(|1,2,3|),
const aLine2 = cons(4, cons(5, cons(6,nil))); // (|4,5,6|),
const aLine3 = cons(7, cons(8, cons(9,nil))); // (|7,8,9|)|)
const aMatrix = cons(aLine1, cons(aLine2, cons(aLine3, nil)));

matrixToString()(aMatrix); // -> "[ (|1, 2, 3|), (|4, 5, 6|), (|7, 8, 9|) ]"

Index

Functions