Hello,
I am trying to make a following table.
=================================
| element | #(1 2 3 4 5 6 7 8 9
| | 10 11 12 13 14 15
| | 16 17)
=================================
The right block is a vector, so the length is not fixed.
In "Common Lisp The Language, 2nd Edition", there is a
PPRIVT-VECTOR function which makes little similar.
(defun pprint-vector (v)
(pprint-logical-block (nil nil :prefix "#(" :suffix ")")
(let ((end (length v))
(i 0))
(when (plusp end)
(loop (pprint-pop)
(write (aref v i))
(if (= (incf i) end) (return nil))
(write-char #\space)
(pprint-newline :fill))))))
However, this doesn't works very well in a combination with FORMAT.
When I tried as follow, I got a strange result.
(format t "~& | element | ~F " (pprint-vector (gethash
'stroke-array-x a)))
; ~F does works when the output is a vector...
(format t "| element | ~F"(pprint-vector (gethash 'vertex-probabilities
(aref object-information 0))))
#(0.18361995988806257 0.18986851739020216 0.4096655293982674
0.8178939962885023 0.844041739245261 0.2577621168183122
0.1474515986267071)| element | NIL
NIL
If :prefix and :per-line-prefix have different functions,
(e.g. :prefix for before the beginning of logical block
:per-line-prefix for beginning of each subsequent line in the
block)
it might be more easier... But it is not.
How can I get the right table print?
Thanks,
Sungwoo