Justification in a format with variable number of items in a list

Viewed 216

So I can do this:

CL-USER> (format t "~80<~a~;~a~;~a~;~a~>~%" "hello" "how are you" "i'm fine" "no you're not")
hello              how are you              i'm fine               no you're not

It evenly spaces the 4 strings across the span of 80 as specified.

However, I want to pass a list of strings, and have it justify those instead, based on however many are in the list.

Neither of these do it:

CL-USER> (format t "~{~80<~a~;~>~}~%" '(1 2 3 4 5 6))
1
2
3
4
5
6

CL-USER> (format t "~80<~{~a~;~}~>~%" '(1 2 3 4 5 6))
; Evaluation aborted on #<SB-FORMAT:FORMAT-ERROR {126651E1}>.
; ~; not contained within either ~[...~] or ~<...~>

Is there a way to do this?

1 Answers
Related