Daitaro Hagihara wrote:
> How do you force format command to evaluate each iteration if possible?
> E.g., (format nil ···@{~D~:*~}" 8 (incf i) nil) to print 8 distinct i's.
You certainly can't do it as it stands[1]. If you don't
mind wrapping the (INCF I) in a lambda, you can use the
~/ feature.
(defun format-call-result (stream argument colonp atp &rest stuff)
(format stream "~A" (funcall argument)))
(let ((i 0))
(format nil ···@{~/format-call-result/~:*~}" 8 (lambda () (incf i)) nil))
===> "12345678"
Why do you want to do this, though? It feels like bad style,
but of course I don't know anything about the application
you have in mind.
[1] Unless you make a new package, shadow FORMAT, and make it
a macro. That way lies madness.
--
Gareth McCaughan ················@pobox.com
.sig under construc