summaryrefslogtreecommitdiffstats
path: root/apps/aux/strings.scm
diff options
context:
space:
mode:
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) " "))))