4 ms·
Reduce/RLISP looks like this: symbolic procedure detq u; % Top level determinant function. begin integer len; len := length u; %
by lispm 10y ago
Reduce/RLISP looks like this:
symbolic procedure detq u;
% Top level determinant function.
begin integer len;
len := length u; % Number of rows.
for each x in u do
if length x neq len then rederr "Non square matrix";
if len=1 then return caar u;
matrix_clrhash();
u := detq1(u,len,0);
matrix_clrhash();
return u
end;
Which would be approximately look like this in Common Lisp:
(defun detq (u &aux (len (length u)))
(dolist (x u)
(if (not (= (length x) len))
(error "Non Square Matrix")))
(if (= len 1)
(return-from detq (caar u)))
(matrix-clrhash)
(setf u (detq1 u len 0))
(matrix-clrhash)
u)