Prevent evaluation
- Subject: Prevent evaluation
- From: Dieter Kaiser
- Date: Tue, 15 Mar 2011 10:47:35 +0100
Am Dienstag, den 15.03.2011, 10:13 +0100 schrieb Dieter Kaiser:
The following patch of the function DIM-$MATRIX corrects the display for
matrices. Matrices are displayed in 2D-form independent from the setting
of the simp-flag. The code can be put into the file maxima-init.lisp.
Then it is loaded when starting Maxima.
(defun dim-$matrix (form result)
(prog (dmstr rstr cstr consp)
(if (or (null (cdr form))
; (not (member 'simp (cdar form) :test #'eq))
(memalike '((mlist simp)) (cdr form))
(dolist (row (cdr form)) (if (not ($listp row)) (return
t))))
(return (dimension-function form result)))
(do ((l (cdadr form) (cdr l))) ((null l))
(setq dmstr (cons nil dmstr) cstr (cons 0 cstr)))
(do ((r (cdr form) (cdr r)) (h1 0) (d1 0))
((or consp (null r))
(setq width 0)
(do ((cs cstr (cdr cs)))
((null cs))
(setq width (+ 2 (car cs) width)))
(setq h1 (1- (+ h1 d1)) depth (truncate h1 2) height (- h1
depth)))
(do ((c (cdar r) (cdr c))
(nc dmstr (cdr nc))
(cs cstr (cdr cs)) (dummy) (h2 0) (d2 0))
((null c) (setq d1 (+ d1 h1 h2) h1 (1+ d2)))
(setq dummy (dimension (car c) nil 'mparen 'mparen nil 0)
h2 (max h2 height) d2 (max d2 depth))
(cond ((not (checkfit (+ 14. width))) (setq consp t) (return
nil))
(t (rplaca nc (cons (list* width height depth dummy) (car
nc)))
(rplaca cs (max width (car cs))))))
(setq rstr (cons d1 rstr)))
(if (> (+ height depth) (length linearray))
(setq consp t))
(return
(cond ((and (not consp) (checkfit (+ 2 width)))
(matout dmstr cstr rstr result))
((and (not consp) (<= level 2)) (colout dmstr cstr result))
(t (dimension-function form result))))))
Dieter Kaiser