From 95a08bc1b290117c1c61c49b3c5c945d01120006 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 31 Oct 2022 18:16:43 +0100 Subject: add sing? --- mew.scm | 7 ++++++- mew.svnwiki | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mew.scm b/mew.scm index 7d9d2ac..b4335c8 100644 --- a/mew.scm +++ b/mew.scm @@ -14,7 +14,7 @@ one-of op op* per prn puts rep - set str slurp + sing? set str slurp tally-accumulator tbl time while until @@ -575,4 +575,9 @@ (generator-fold f v g))))) ((f v) (lambda (o) (generator-fold f v (gen o)))))) + + (define (sing? l) + (match l + ((_) #t) + (_ #f))) ) diff --git a/mew.svnwiki b/mew.svnwiki index c3c03c7..1f6a963 100644 --- a/mew.svnwiki +++ b/mew.svnwiki @@ -151,6 +151,10 @@ applying {{display}} to all {{}}. Expands to a lambda expression that is true if its argument is {{equal?}} to any of the {{}} passed. +(sing? ) + +Return true iff {{}} is a proper list of length 1. + == I/O helpers @@ -300,6 +304,7 @@ by {{gen}}) and folds the function {{}} over its values. If given, folding starts with {{}}, else with the first element yielded by the generator. If the generator is empty, return {{()}}. + == Regular expressions (?~ ) -- cgit 1.4.1