How can I put an argument with zeros using a function of the lisp format?

I play with a function of the lisp format, but I fell into the trap because, although I can get it to write a list of numbers aligned well, I cannot get it to get a null pad:

(defun inc (a) (+ 1 a))
(dotimes (i 10)
  (format t "~3@:D ~:*~R~%" (inc i)))

This leads to the following conclusion:

+1: one
+2: two
+3: three
+4: four
+5: five
+6: six
+7: seven
+8: eight
+9: nine
+10: ten

Does anyone know how to get a null value?

+5
source share
1 answer

Example taken from the PCL chapter in FORMAT format :

(format nil "~12d" 1000000)    ==> "     1000000"
(format nil "~12,'0d" 1000000) ==> "000001000000"
+9
source

All Articles