at-sign-modifier-supplied-p)) (declare (type (integer 0 *) repetitions)) (let ((string-to-print format-argument)) (declare (type string string-to-print)) ;; Adjust the STRING-TO-PRINT based upon the modifiers. (cond ((and colon-modifier-supplied-p at-sign-modifier-supplied-p) (setf string-to-print (reverse string-to-print))) (colon-modifier-supplied-p (setf string-to-print (string-downcase string-to-print))) (at-sign-modifier-supplied-p (setf string-to-print (string-upcase string-to-print))) (T NIL)) (loop repeat repetitions do (format destination "~a" string-to-print)))) ;; Print "Hello" a single time. (format T "~/mydirective/" "Hello") ;; Print "Hello" three times. (format T "~3/mydirective/" "Hello") ;; Print a lowercase "Hello" (= "hello") three times. (format T "~3:/mydirective/" "Hello") ;; Print an uppercase "Hello" (= "HELLO") three times. (format T "~3@/mydirective/" "Hello") ;; Print a reversed "Hello" (= "olleH") three times. (format T "~3:@/mydirective/" "Hello") Whilst format is somewhat infamous for its tendency to become opaque and hard to read, it provides a remarkably concise yet powerful syntax for a specialised and common need. A Common Lisp FORMAT summary table is available. References Books Common Lisp HyperSpec Section 22.3 Formatted Output Practical Common Lisp Chapter 18. A Few FORMAT Recipes Common Lisp