(defun write-repeated-string (n string stream)
(loop repeat n do (write-string string stream)))
(write-repeated-string 5 "hi" *standard-output*))
Typically, you can use format iteration:
(format t "~v@{~A~:*~}" 5 "hi")
~Acan output all kinds of elements, not just characters. For more information, see uselpa Related Answers.
Above enumerates the iteration number from the first argument. So vbehind the tilde.
The remaining arguments will be used by iteration. In this way @.
. , ~:*.
(format t "~v{~A~:*~}" 5 '("hi")), .