Implement row delimiters.
This commit is contained in:
parent
e01a6db5a6
commit
64ff4255e3
4 changed files with 58 additions and 3 deletions
11
utils.scm
11
utils.scm
|
@ -29,11 +29,13 @@
|
|||
utils
|
||||
(
|
||||
filter
|
||||
string-repeat
|
||||
utils-tests!
|
||||
)
|
||||
|
||||
(import scheme
|
||||
(chicken base)
|
||||
(chicken string)
|
||||
testing)
|
||||
|
||||
;; Returns a list with elements matching pred? predicate.
|
||||
|
@ -48,6 +50,15 @@
|
|||
(loop (cdr lst)
|
||||
res)))))
|
||||
|
||||
;; Repeats given string.
|
||||
(define (string-repeat str rep)
|
||||
(let loop ((rep rep)
|
||||
(res '()))
|
||||
(if (> rep 0)
|
||||
(loop (sub1 rep)
|
||||
(cons str res))
|
||||
(string-intersperse res ""))))
|
||||
|
||||
;; Performs utils module self-tests.
|
||||
(define (utils-tests!)
|
||||
(run-tests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue