summaryrefslogtreecommitdiffstats
path: root/apps/aux/strings.scm
diff options
context:
space:
mode:
authorAndreas Widen <andreas@harmonicflow.org>2023-11-25 17:21:37 +0100
committerAndreas Widen <andreas@harmonicflow.org>2023-11-25 17:21:37 +0100
commit1b2b7c3eb939724696894f31ff27db97b0cac84c (patch)
treeefb7b7746a628efb7bb99b2e44c9c2fbfd75b656 /apps/aux/strings.scm
downloadhf-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.scm12
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) " "))))