diff options
author | Andreas Widen <andreas@harmonicflow.org> | 2023-11-25 17:21:37 +0100 |
---|---|---|
committer | Andreas Widen <andreas@harmonicflow.org> | 2023-11-25 17:21:37 +0100 |
commit | 1b2b7c3eb939724696894f31ff27db97b0cac84c (patch) | |
tree | efb7b7746a628efb7bb99b2e44c9c2fbfd75b656 /apps/aux/strings.scm | |
download | hf-web-1b2b7c3eb939724696894f31ff27db97b0cac84c.tar.xz hf-web-1b2b7c3eb939724696894f31ff27db97b0cac84c.zip |
Initial commit.
Signed-off-by: Andreas Widen <andreas@harmonicflow.org>
Diffstat (limited to 'apps/aux/strings.scm')
-rw-r--r-- | apps/aux/strings.scm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/aux/strings.scm b/apps/aux/strings.scm new file mode 100644 index 0000000..7004721 --- /dev/null +++ b/apps/aux/strings.scm @@ -0,0 +1,12 @@ +;;; Harmonic Flow web site + +(define-module (apps aux strings) + #:export (string-summarize)) + + +(define (string-summarize string n) + "Return an extract of N words from the given STRING." + (let ((words (string-split string #\space))) + (if (<= (length words) n) + string + (string-join (list-head words n) " ")))) |