From 1b2b7c3eb939724696894f31ff27db97b0cac84c Mon Sep 17 00:00:00 2001 From: Andreas Widen Date: Sat, 25 Nov 2023 17:21:37 +0100 Subject: Initial commit. Signed-off-by: Andreas Widen --- apps/aux/strings.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 apps/aux/strings.scm (limited to 'apps/aux/strings.scm') 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) " ")))) -- cgit v1.2.3-54-g00ecf