Hi,
I've to print a matrix of numbers and currently I use a simple format in
a double iteration:
(defun print-spreadsheet (spreadsheet)
(dolist (matrix (mapcar #'eval-spreadsheet spreadsheet))
(dotimes (row (array-dimension matrix 0))
(dotimes (column (array-dimension matrix 1))
(format t "~A " (aref matrix row column)))
(format t "~%"))))
The output is the following:
100 34 37 171
40 1700 34 1774
140 1734 71 1945
I'd like to improve the output maintaining a column format and dividing
the cells with pipe:
|100| 34| 37| 171|
| 40| 1700| 34| 1774|
|140| 1734| 71| 1945|
Is there a library for this work or I've to use the format function in a
better way?
Thanks
Giannandrea
Giannandrea Castaldi <········@tiscali.it> writes:
> Is there a library for this work or I've to use the format function in
> a better way?
Yes.
(defun print-spreadsheet (spreadsheet)
(format t "~&~{|~{~6D~^|~}~%~}"
(matrix (mapcar #'eval-spreadsheet spreadsheet))))
--
__Pascal_Bourguignon__ http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he doesn't
want merely because you think it would be good for him.--Robert Heinlein
http://www.theadvocates.org/