summaryrefslogtreecommitdiff
path: root/bs/string.scm
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2022-07-23 22:24:34 -0400
committerBen Sima <ben@bsima.me>2022-07-23 22:31:34 -0400
commitf91d101dffb51c8eb207914833d1a5241149ae7b (patch)
treee0d8e3a036e377a93e84dc2a35c9994a511f3ca6 /bs/string.scm
parent19dd1eef9d279aa468d4e179abad375d7271dc2a (diff)
Move comments to docstrings
Just spent an hour implementing my own doc system, just to find out this is built in to guile :(
Diffstat (limited to 'bs/string.scm')
-rw-r--r--bs/string.scm10
1 files changed, 5 insertions, 5 deletions
diff --git a/bs/string.scm b/bs/string.scm
index 8839512..9fe794e 100644
--- a/bs/string.scm
+++ b/bs/string.scm
@@ -17,29 +17,29 @@
;; TODO: remove or port ice-9 dependency
(only (ice-9 ports) with-output-to-string))
- ;; Is `pre` a prefix of `s`?
(define (prefix? s pre)
+ "Is PRE a prefix of S?"
(string-prefix? pre s))
- ;; Is `suf` a suffix of `s`?
(define (suffix? s suf)
+ "Is SUF a suffix of S?"
(string-suffix? suf s))
- ;; Split `s` at `sep`
(define (split s sep)
+ "Split S at SEP"
;; this is still wrong. it splits on any of the "sep" characters
;; instead of all of them
(string-tokenize s (char-set-complement (apply char-set (string->list sep)))))
- ;; Replace `match` in `s` with `char`
(define (replace-char s match char)
+ "Replace MATCH in S with CHAR"
(let ((f (lambda (a b)
(let ((next-char (if (eq? a match) char a)))
(string-concatenate (list b (string next-char)))))))
(string-fold f "" s)))
- ;; Replace `match` in `s` with `repl`
(define (replace s match repl)
+ "Replace MATCH in S with REPL"
;; based on string-replace-substring By A. Wingo in
;; https://lists.gnu.org/archive/html/guile-devel/2014-03/msg00058.html
;; also in string-replace-substring guix:guix/utils.scm.