Repeat a string: Difference between revisions
→{{header|Common Lisp}}
Line 362:
do (setf (subseq result i (+ i len)) string))
result)</lang>
For those who love conciseness and efficiency, even at the cost of readability:
<lang lisp>(defun repeat-string (n string)
(format nil "~V@{~a~:*~}" n string))</lang>
<lang lisp>(princ (repeat-string 5 "hi"))</lang>
A single character may be repeated using just the builtin <code>make-string</code>:
|