(format t "begin~{~<end~%begin~1,20:; ~d~>~^,~}" '(1 2 3 4 5 6 7 8 9 10))
produces:
begin 1, 2, 3, 4, 5,end
begin 6, 7, 8, 9,end
begin 10
However, what I'd like is:
begin 1, 2, 3, 4, 5 end
begin 6, 7, 8, 9 end
begin 10 end
Anybody knows the right format control incantation to do this?
--
Nicolas Rouquette Artificial Intelligence Group
Email: ········@aig.jpl.nasa.gov Jet Propulsion Laboratory, M/S 525-3960
Phone: (818) 306-6916 4800 Oak Grove Dr.
Fax: (818) 306-6912 Pasadena, CA 91109
In article <··········@overcat.jpl.nasa.gov> ········@overcat.jpl.nasa.gov (Nicolas Rouquette) writes:
>(format t "begin~{~<end~%begin~1,20:; ~d~>~^,~}" '(1 2 3 4 5 6 7 8 9 10))
...
>However, what I'd like is:
>
>begin 1, 2, 3, 4, 5 end
>begin 6, 7, 8, 9 end
>begin 10 end
I don't think this can be done only with FORMAT. The iteration and
justification controls don't communicate with each other, so there's no way
to make ~^ treat the wrapping iterations specially. It only special-cases
the last iteration of all.
The best way to do this, I think, is to format into a string and add the
commas and begin/end's yourself.
--
Barry Margolin
System Manager, Thinking Machines Corp.
······@think.com {uunet,harvard}!think!barmar