up previous next
list

convert an expression into a list

Syntax
list(E:OBJECT):LIST

where E has type LIST, MAT, or VECTOR.

Description
This function converts the expression E into a list. It is the same as Cast(E, LIST).

Example
/**/  M := mat([[1,2], [3,4]]);
/**/  M;
matrix([
  [1, 2],
  [3, 4]
])

/**/  first(M);  -- the WRONG WAY to compute the first row of M
ERROR: Expecting type LIST, but found type MAT
 first(M);
       ^

/**/  GetRow(M, 1);  -- the RIGHT WAY to compute the first row of M
[1, 2]

/**/  first(list(M));
[1, 2]

See Also