summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-11-07 22:54:34 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-11-07 22:54:34 +0100
commit7e5aec50898398e62ac9f64a81f28cf940f0a3e3 (patch)
tree26319ee15fe3574e15aff8e63d3074c23082ad20
parent8972b21868d475a6a54c9719e6dd8167d5827ce6 (diff)
downloadmew-7e5aec50898398e62ac9f64a81f28cf940f0a3e3.tar.gz
mew-7e5aec50898398e62ac9f64a81f28cf940f0a3e3.tar.xz
mew-7e5aec50898398e62ac9f64a81f28cf940f0a3e3.zip
add xcond
-rw-r--r--mew.scm6
-rw-r--r--mew.svnwiki4
2 files changed, 10 insertions, 0 deletions
diff --git a/mew.scm b/mew.scm
index a56d4ec..4e060a4 100644
--- a/mew.scm
+++ b/mew.scm
@@ -22,6 +22,7 @@
      while
      uniq-accumulator unlist until
      vals void?
+     xcond
      -> fun-> fun->> set->
      =? <>?
      ~?
@@ -270,6 +271,11 @@
       ((_ cond body ...)
        (while (not cond) body ...))))
 
+  (define-syntax xcond
+    (syntax-rules ()
+      ((_ rest ...)
+       (cond rest ... (else (error "missing case in xcond"))))))
+
   (define (list-ref-default l i default)
     (if (null? l)
       default
diff --git a/mew.svnwiki b/mew.svnwiki
index 6a8432f..5722d8c 100644
--- a/mew.svnwiki
+++ b/mew.svnwiki
@@ -124,6 +124,10 @@ As in R7RS-small.
 
 Evaluate {{<expr>}} while {{<cond>}} is true/false.
 
+<syntax>(xcond <cases>...)<syntax>
+
+Like {{cond}}, but raise error if no case matched.
+
 
 == Numeric helpers