blob: 6e727937dab76bb9e770baa5e0c43cb273ba7023 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
;;; ps-string: string utilities for Pre-Scheme
(define (string-copy! target offset source start end)
(do ((tgt offset (+ tgt 1))
(src start (+ src 1)))
((= src end))
(string-set! target tgt (string-ref source src)))
(unspecific))
(define (string-append a b)
(let* ((len-a (string-length a))
(len-b (string-length b))
(target (make-string (+ len-a len-b))))
(string-copy! target 0 a 0 len-a)
(string-copy! target len-a b 0 len-b)
target))
(define (string-repeat source n)
(let* ((len (string-length source))
(total (* len n))
(target (make-string total)))
(do ((ix 0 (+ ix len)))
((= ix total))
(string-copy! target ix source 0 len))
target))
|