| copy-string | ||
|---|---|---|
| Prev | Next | |
(copy-string string num)
Copies string num times and returns the result.
(copy-string "x" 3) returns "xxx"
Norman Walsh, <ndw@nwalsh.com>
(define (copy-string string num)
;; Return a string duplicated a specified number of times
(if (<= num 0)
""
(let loop ((str string) (count (- num 1)))
(if (<= count 0)
str
(loop (string-append str string) (- count 1))))))| Prev | Home | Next |
| constant-list | Up | decrement-list-members |