(defun dump-db ()
(dolist (cd *db*)
(format t "~{~a:~10t~a~%~}~%" cd)))
The dolist makes it go through every element of the list *db* with the variable cd right?
and ~a means print it in a more readable form, but these two confuse me.
~{ ~} does this mean anything in between will be the way every element of *db* will be formatted?
What's the : in ~{~a:?
[The] iteration directive
~{[...] tellsFORMATto iterate over the elements of a list or over the implicit list of the format arguments. 1
The : isn't a format directive, it's just printed verbatim in after each element:
> (format t "~{~a: ~}" '(foo bar))
FOO: BAR:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With