summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2012-01-20 19:47:02 +0100
committerAndy Wingo <wingo@pobox.com>2012-01-20 19:51:45 +0100
commit9accf3d98ffd1d9d484e5214a9dd9e4054204557 (patch)
tree8aa53e7eabc6bc4ca6a3a8adafac94d9b0a2da09 /module
parent7d02e256610e37c0ab0e8c55623d6f6c6eacab82 (diff)
downloadguile-9accf3d98ffd1d9d484e5214a9dd9e4054204557.tar.gz
add when, unless
* module/ice-9/boot-9.scm (when, unless): New forms. * doc/ref/api-control.texi (Conditionals): Add docs. Rename this node from "if cond case". * doc/ref/r6rs.texi: * doc/ref/scheme-ideas.texi: * doc/ref/srfi-modules.texi: Update referrers.
Diffstat (limited to 'module')
-rw-r--r--module/ice-9/boot-9.scm6
1 files changed, 6 insertions, 0 deletions
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index d006d4700..86ca875a5 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -412,6 +412,12 @@ If there is no handler at all, Guile prints an error and then exits."
((_ x) x)
((_ x y ...) (let ((t x)) (if t t (or y ...))))))
+(define-syntax-rule (when test stmt stmt* ...)
+ (if test (begin stmt stmt* ...)))
+
+(define-syntax-rule (unless test stmt stmt* ...)
+ (if (not test) (begin stmt stmt* ...)))
+
;; The "maybe-more" bits are something of a hack, so that we can support
;; SRFI-61. Rewrites into a standalone syntax-case macro would be
;; appreciated.