+Most files' packages determined in src/devvars
[lineal.git] / src / math / format.lisp
blob6a133d18c633b4950fb2560f97a75530c494f8de
2 (defun max-width (&rest nums)
3 (loop :for x :in nums
4 :maximize (length (princ-to-string x))))
6 (defun output-tuple (u &optional (strm t))
7 (format strm "(~{~D~#[~:;, ~]~})" u))
9 (defun output-matrix (mat &optional (strm t))
10 (fresh-line strm)
11 (loop
12 :with widths = (apply #'mapcar #'max-width mat)
13 :for row :in mat :do
14 (princ "[" strm) :do
15 (loop
16 :for width :on widths
17 :and elem :in row
18 :if (cdr width) :do
19 (format strm "~V,@A " (car width) elem)
20 :else :do (format strm "~V,@A]~%" (car width) elem))))