--Copyright The Numerical Algorithms Group Limited 1991.

)clear all
-- this file shows nesting of matrices
m:SQMATRIX(2,INT) := squareMatrix matrix [[0,1],[-1,0]]
-- this determinant can be computed
determinant m
n:SQMATRIX(2,SQMATRIX(2,INT)) :=
  squareMatrix matrix [[m,m**2],[m**3,m**4]]
-- this determinant cannot be computed by Scratchpad II
-- because there is no function that computes the determinant of a
-- matrix whose entries belong to a noncommutative ring
)set mes test off
determinant n
)set mes test on
-- another level of matrix
o:SQMATRIX(2,SQMATRIX(2,SQMATRIX(2,INT))) :=
   squareMatrix matrix [[n,n**2],[n**3,n**4]]
o ** 2
-- add 2 to this matrix
% + 2
-- what is 2 as a matrix?
o := 2
